feat(cmd): enable -target parameter for build, run, and test commands
- Update build command: llgo build -target platform - Update run command: llgo run -target platform - Update test command: llgo test -target platform - Wire target flag to build configuration - Update usage documentation for new parameter Examples: - llgo build -target rp2040 ./firmware - llgo run -target wasi ./main.go - llgo test -target cortex-m ./tests 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -29,7 +29,7 @@ import (
|
||||
|
||||
// llgo build
|
||||
var Cmd = &base.Command{
|
||||
UsageLine: "llgo build [-o output] [build flags] [packages]",
|
||||
UsageLine: "llgo build [-o output] [-target platform] [build flags] [packages]",
|
||||
Short: "Compile packages and dependencies",
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ func runCmd(cmd *base.Command, args []string) {
|
||||
conf.Tags = flags.Tags
|
||||
conf.Verbose = flags.Verbose
|
||||
conf.OutFile = flags.OutputFile
|
||||
conf.Target = flags.Target
|
||||
|
||||
args = cmd.Flag.Args()
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ var (
|
||||
|
||||
// llgo run
|
||||
var Cmd = &base.Command{
|
||||
UsageLine: "llgo run [build flags] package [arguments...]",
|
||||
UsageLine: "llgo run [-target platform] [build flags] package [arguments...]",
|
||||
Short: "Compile and run Go program",
|
||||
}
|
||||
|
||||
@@ -54,11 +54,11 @@ func init() {
|
||||
}
|
||||
|
||||
func runCmd(cmd *base.Command, args []string) {
|
||||
runCmdEx(cmd, args, build.ModeRun)
|
||||
runCmdEx(cmd, args, build.ModeRun) // support target
|
||||
}
|
||||
|
||||
func runCmpTest(cmd *base.Command, args []string) {
|
||||
runCmdEx(cmd, args, build.ModeCmpTest)
|
||||
runCmdEx(cmd, args, build.ModeCmpTest) // no target support
|
||||
}
|
||||
|
||||
func runCmdEx(cmd *base.Command, args []string, mode build.Mode) {
|
||||
@@ -71,6 +71,7 @@ func runCmdEx(cmd *base.Command, args []string, mode build.Mode) {
|
||||
conf.Tags = flags.Tags
|
||||
conf.Verbose = flags.Verbose
|
||||
conf.GenExpect = flags.Gen
|
||||
conf.Target = flags.Target
|
||||
|
||||
args = cmd.Flag.Args()
|
||||
args, runArgs, err := parseRunArgs(args)
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
// llgo test
|
||||
var Cmd = &base.Command{
|
||||
UsageLine: "llgo test [build flags] package [arguments...]",
|
||||
UsageLine: "llgo test [-target platform] [build flags] package [arguments...]",
|
||||
Short: "Compile and run Go test",
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ func runCmd(cmd *base.Command, args []string) {
|
||||
conf := build.NewDefaultConf(build.ModeTest)
|
||||
conf.Tags = flags.Tags
|
||||
conf.Verbose = flags.Verbose
|
||||
conf.Target = flags.Target
|
||||
|
||||
args = cmd.Flag.Args()
|
||||
_, err := build.Do(args, conf)
|
||||
|
||||
Reference in New Issue
Block a user