forked from joejulian/gio
cmd/gio: rename -v to -x and add -work
The verbose flag only triggered printing of commands, which is traditionally named -x by other Go tools. The -work flag will print and preserve the temporary directory. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+7
-2
@@ -19,7 +19,8 @@ var (
|
|||||||
buildMode = flag.String("buildmode", "exe", "specify buildmode: archive or exe")
|
buildMode = flag.String("buildmode", "exe", "specify buildmode: archive or exe")
|
||||||
destPath = flag.String("o", "", "output file (Android .aar or .apk file) or directory (iOS/tvOS .framework or webassembly files)")
|
destPath = flag.String("o", "", "output file (Android .aar or .apk file) or directory (iOS/tvOS .framework or webassembly files)")
|
||||||
appID = flag.String("appid", "org.gioui.app", "app identifier (for -buildmode=exe)")
|
appID = flag.String("appid", "org.gioui.app", "app identifier (for -buildmode=exe)")
|
||||||
verbose = flag.Bool("v", false, "verbose output")
|
printCommands = flag.Bool("x", false, "print the commands")
|
||||||
|
keepWorkdir = flag.Bool("work", false, "print the name of the temporary work directory and do not delete it when exiting.")
|
||||||
)
|
)
|
||||||
|
|
||||||
type buildInfo struct {
|
type buildInfo struct {
|
||||||
@@ -89,7 +90,11 @@ func build(bi *buildInfo) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if *keepWorkdir {
|
||||||
|
fmt.Fprintf(os.Stderr, "WORKDIR=%s\n", tmpDir)
|
||||||
|
} else {
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
}
|
||||||
switch *target {
|
switch *target {
|
||||||
case "js":
|
case "js":
|
||||||
return buildJS(bi)
|
return buildJS(bi)
|
||||||
@@ -108,7 +113,7 @@ func errorf(format string, args ...interface{}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runCmdRaw(cmd *exec.Cmd) ([]byte, error) {
|
func runCmdRaw(cmd *exec.Cmd) ([]byte, error) {
|
||||||
if *verbose {
|
if *printCommands {
|
||||||
fmt.Printf("%s\n", strings.Join(cmd.Args, " "))
|
fmt.Printf("%s\n", strings.Join(cmd.Args, " "))
|
||||||
}
|
}
|
||||||
out, err := cmd.Output()
|
out, err := cmd.Output()
|
||||||
|
|||||||
Reference in New Issue
Block a user