From 4005c66f1b3a74d2e687e2ab8c34fa2e5bd2d96e Mon Sep 17 00:00:00 2001 From: Daniel Mai Date: Tue, 16 Mar 2021 22:18:01 -0700 Subject: [PATCH] fix(flags): Expose global flags to dgraph subcommands. (#7530) This updates the subcommand --help template so that flags like `--config` show up in the --help output under the "Global Flags:" section. Example: $ dgraph alpha --help ... Global Flags: --alsologtostderr log to standard error as well as files --bindall Use 0.0.0.0 instead of localhost to bind to all addresses on local machine. (default true) --block_rate int Block profiling rate. Must be used along with block profile_mode --config string Configuration file. Takes precedence over default values, but is overridden to values set with environment variables and flags. --cwd string Change working directory to the path specified. The parent must exist. --expose_trace Allow trace endpoint to be accessible from remote --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files --profile_mode string Enable profiling mode, one of [cpu, mem, mutex, block] -v, --v Level log level for V logs --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging --- x/x.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x/x.go b/x/x.go index 0b052154351..84113446930 100644 --- a/x/x.go +++ b/x/x.go @@ -1378,6 +1378,9 @@ Available Commands: {{range .Commands}}{{if (or .IsAvailableCommand)}} Flags: {{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}} +Global Flags: +{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasHelpSubCommands}} + Use "{{.CommandPath}} [command] --help" for more information about a command.{{end}} `