issue #377 GoRun -a {arguments}

This commit is contained in:
ray-x 2023-09-22 20:32:02 +10:00
parent dca79d6aad
commit a43a3cba1e
2 changed files with 10 additions and 5 deletions

View File

@ -277,8 +277,9 @@ first run of `GoFmt` may fail. Recommended to run `GoInstallBinaries` to install
| GoMake | async make, use with other commands | | GoMake | async make, use with other commands |
| GoBuild args | go build args (-g: enable debug, %: expand to current file, %:h expand to current package) | | GoBuild args | go build args (-g: enable debug, %: expand to current file, %:h expand to current package) |
| GoGenerate | | | GoGenerate | |
| GoRun {args} | e.g. GoRun equal to `go run .`; or `GoRun ./cmd` equal to `go run ./cmd, Additional args: -F run in floaterm` | | GoRun {args} -a {cmd_args} | e.g. GoRun equal to `go run .`; or `GoRun ./cmd` equal to `go run ./cmd, Additional args: -F run in floaterm` |
| GoStop {job_id} | `stop the job started with GoRun` | | GoRun -a {cmd_args} | specify additional arguments pass to your main(), see notes 3 |
| GoStop {job_id} | `stop the job started with GoRun` |
| GoTest | go test ./... | | GoTest | go test ./... |
| GoTestSum {pkgname} {gotestsum arguments} | run gotestsum and show result in side panel | | GoTestSum {pkgname} {gotestsum arguments} | run gotestsum and show result in side panel |
| GoTestSum -w | run gotestsum in watch mode | | GoTestSum -w | run gotestsum in watch mode |
@ -307,7 +308,7 @@ Note:
1. if package_url not provided, will check current line is a valid package url or not, if it is valid, will 1. if package_url not provided, will check current line is a valid package url or not, if it is valid, will
fetch current url fetch current url
2. tags: if `//+build tags` exist it will be added automatically 2. tags: if `//+build tags` exist it will be added automatically
3. args: if multiple args is provided, you need toconcatenate it with '\ ', e.g. GoTest -args yourtags\ other_args 3. args: if multiple args is provided, you need toconcatenate it with '\ ', e.g. GoTest -a yourtags\ other_args
4. % will expand to current file path, e.g. GoBuild % 4. % will expand to current file path, e.g. GoBuild %
Show test coverage: Show test coverage:

View File

@ -201,8 +201,12 @@ function M.make(...)
end end
if optarg['a'] then if optarg['a'] then
table.insert(cmd, '-args') if runner == 'go run' then
table.insert(cmd, optarg['a']) table.insert(cmd, optarg['a'])
else
table.insert(cmd, '-args')
table.insert(cmd, optarg['a'])
end
end end
local function handle_color(line) local function handle_color(line)