mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-18 08:29:55 +01:00
* feat: Update CLI to pass parameters through to Task commands - Modified build and package commands to accept otherArgs parameter - Updated task wrapper to forward CLI variables to Task - Enhanced task.go to properly parse and handle CLI variables (KEY=VALUE format) - Fixes issue where 'wails3 build' and 'wails3 package' commands weren't forwarding parameters Fixes #4422 * Update changelog * Apply suggestion from @coderabbitai[bot] Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Fix cli.mdx --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
29 lines
915 B
Go
29 lines
915 B
Go
package commands
|
|
|
|
import (
|
|
"github.com/wailsapp/wails/v3/internal/term"
|
|
"os"
|
|
|
|
"github.com/wailsapp/wails/v3/internal/flags"
|
|
)
|
|
|
|
// runTaskFunc is a variable to allow mocking in tests
|
|
var runTaskFunc = RunTask
|
|
|
|
func Build(_ *flags.Build, otherArgs []string) error {
|
|
return wrapTask("build", otherArgs)
|
|
}
|
|
|
|
func Package(_ *flags.Package, otherArgs []string) error {
|
|
return wrapTask("package", otherArgs)
|
|
}
|
|
|
|
func wrapTask(command string, otherArgs []string) error {
|
|
term.Warningf("`wails3 %s` is an alias for `wails3 task %s`. Use `wails task` for better control and more options.\n", command, command)
|
|
// Rebuild os.Args to include the command and all additional arguments
|
|
newArgs := []string{"wails3", "task", command}
|
|
newArgs = append(newArgs, otherArgs...)
|
|
os.Args = newArgs
|
|
// Pass the task name via options and otherArgs as CLI variables
|
|
return runTaskFunc(&RunTaskOptions{Name: command}, otherArgs)
|
|
}
|