diff options
| author | Patrice Arruda <patricearruda@google.com> | 2019-06-17 17:27:09 -0700 |
|---|---|---|
| committer | Michael Bestas <mkbestas@lineageos.org> | 2019-12-11 19:03:32 +0200 |
| commit | 2bf79ea5dc80c10019437d9b417a6e53091cbc86 (patch) | |
| tree | 4e4da0e99a8cada9f1f46830f8fc1045a4d6d896 /cmd | |
| parent | bbaa0880272e7e5972a99e8004412d8915abdee2 (diff) | |
| download | build_soong-2bf79ea5dc80c10019437d9b417a6e53091cbc86.tar.gz build_soong-2bf79ea5dc80c10019437d9b417a6e53091cbc86.tar.bz2 build_soong-2bf79ea5dc80c10019437d9b417a6e53091cbc86.zip | |
Soong: Use ctx.Writer in flag usage for dumpVar and dumpVars in soong_ui.
ctx.Writer is recommended stream to use for standard io.
Fixes: b/135487952
Test: Lunch and executed ./out/soong_ui --dumpvar-mode and
--dumpvars-mode to check the usage is output to the console.
Change-Id: I38351ebdb05f49f92d6b4bfb0423092299d1c5ea
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/soong_ui/main.go | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/cmd/soong_ui/main.go b/cmd/soong_ui/main.go index 0d5ed444..ce426da1 100644 --- a/cmd/soong_ui/main.go +++ b/cmd/soong_ui/main.go @@ -207,13 +207,13 @@ func fixBadDanglingLink(ctx build.Context, name string) { func dumpVar(ctx build.Context, config build.Config, args []string, _ string) { flags := flag.NewFlagSet("dumpvar", flag.ExitOnError) flags.Usage = func() { - fmt.Fprintf(os.Stderr, "usage: %s --dumpvar-mode [--abs] <VAR>\n\n", os.Args[0]) - fmt.Fprintln(os.Stderr, "In dumpvar mode, print the value of the legacy make variable VAR to stdout") - fmt.Fprintln(os.Stderr, "") + fmt.Fprintf(ctx.Writer, "usage: %s --dumpvar-mode [--abs] <VAR>\n\n", os.Args[0]) + fmt.Fprintln(ctx.Writer, "In dumpvar mode, print the value of the legacy make variable VAR to stdout") + fmt.Fprintln(ctx.Writer, "") - fmt.Fprintln(os.Stderr, "'report_config' is a special case that prints the human-readable config banner") - fmt.Fprintln(os.Stderr, "from the beginning of the build.") - fmt.Fprintln(os.Stderr, "") + fmt.Fprintln(ctx.Writer, "'report_config' is a special case that prints the human-readable config banner") + fmt.Fprintln(ctx.Writer, "from the beginning of the build.") + fmt.Fprintln(ctx.Writer, "") flags.PrintDefaults() } abs := flags.Bool("abs", false, "Print the absolute path of the value") @@ -257,15 +257,15 @@ func dumpVar(ctx build.Context, config build.Config, args []string, _ string) { func dumpVars(ctx build.Context, config build.Config, args []string, _ string) { flags := flag.NewFlagSet("dumpvars", flag.ExitOnError) flags.Usage = func() { - fmt.Fprintf(os.Stderr, "usage: %s --dumpvars-mode [--vars=\"VAR VAR ...\"]\n\n", os.Args[0]) - fmt.Fprintln(os.Stderr, "In dumpvars mode, dump the values of one or more legacy make variables, in") - fmt.Fprintln(os.Stderr, "shell syntax. The resulting output may be sourced directly into a shell to") - fmt.Fprintln(os.Stderr, "set corresponding shell variables.") - fmt.Fprintln(os.Stderr, "") - - fmt.Fprintln(os.Stderr, "'report_config' is a special case that dumps a variable containing the") - fmt.Fprintln(os.Stderr, "human-readable config banner from the beginning of the build.") - fmt.Fprintln(os.Stderr, "") + fmt.Fprintf(ctx.Writer, "usage: %s --dumpvars-mode [--vars=\"VAR VAR ...\"]\n\n", os.Args[0]) + fmt.Fprintln(ctx.Writer, "In dumpvars mode, dump the values of one or more legacy make variables, in") + fmt.Fprintln(ctx.Writer, "shell syntax. The resulting output may be sourced directly into a shell to") + fmt.Fprintln(ctx.Writer, "set corresponding shell variables.") + fmt.Fprintln(ctx.Writer, "") + + fmt.Fprintln(ctx.Writer, "'report_config' is a special case that dumps a variable containing the") + fmt.Fprintln(ctx.Writer, "human-readable config banner from the beginning of the build.") + fmt.Fprintln(ctx.Writer, "") flags.PrintDefaults() } |
