Soong: Use ctx.Writer in flag usage for dumpVar and dumpVars in soong_ui.

am: db4c2f115e

Change-Id: Ib40cf1bf9158c6931c87dcccd90e877da57b05ea
This commit is contained in:
Patrice Arruda
2019-06-18 15:27:17 -07:00
committed by android-build-merger

View File

@@ -188,13 +188,13 @@ func main() {
func dumpVar(ctx build.Context, config build.Config, args []string, _ string) { func dumpVar(ctx build.Context, config build.Config, args []string, _ string) {
flags := flag.NewFlagSet("dumpvar", flag.ExitOnError) flags := flag.NewFlagSet("dumpvar", flag.ExitOnError)
flags.Usage = func() { flags.Usage = func() {
fmt.Fprintf(os.Stderr, "usage: %s --dumpvar-mode [--abs] <VAR>\n\n", os.Args[0]) fmt.Fprintf(ctx.Writer, "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(ctx.Writer, "In dumpvar mode, print the value of the legacy make variable VAR to stdout")
fmt.Fprintln(os.Stderr, "") fmt.Fprintln(ctx.Writer, "")
fmt.Fprintln(os.Stderr, "'report_config' is a special case that prints the human-readable config banner") fmt.Fprintln(ctx.Writer, "'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(ctx.Writer, "from the beginning of the build.")
fmt.Fprintln(os.Stderr, "") fmt.Fprintln(ctx.Writer, "")
flags.PrintDefaults() flags.PrintDefaults()
} }
abs := flags.Bool("abs", false, "Print the absolute path of the value") abs := flags.Bool("abs", false, "Print the absolute path of the value")
@@ -238,15 +238,15 @@ func dumpVar(ctx build.Context, config build.Config, args []string, _ string) {
func dumpVars(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 := flag.NewFlagSet("dumpvars", flag.ExitOnError)
flags.Usage = func() { flags.Usage = func() {
fmt.Fprintf(os.Stderr, "usage: %s --dumpvars-mode [--vars=\"VAR VAR ...\"]\n\n", os.Args[0]) fmt.Fprintf(ctx.Writer, "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(ctx.Writer, "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(ctx.Writer, "shell syntax. The resulting output may be sourced directly into a shell to")
fmt.Fprintln(os.Stderr, "set corresponding shell variables.") fmt.Fprintln(ctx.Writer, "set corresponding shell variables.")
fmt.Fprintln(os.Stderr, "") fmt.Fprintln(ctx.Writer, "")
fmt.Fprintln(os.Stderr, "'report_config' is a special case that dumps a variable containing the") fmt.Fprintln(ctx.Writer, "'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(ctx.Writer, "human-readable config banner from the beginning of the build.")
fmt.Fprintln(os.Stderr, "") fmt.Fprintln(ctx.Writer, "")
flags.PrintDefaults() flags.PrintDefaults()
} }