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:
Li Jie
2025-07-29 15:12:25 +08:00
parent 0136344282
commit daf0d7e56e
4 changed files with 45 additions and 21 deletions

View File

@@ -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)