Skip to content

Commit

Permalink
fix(flags): Expose global flags to dgraph subcommands. (#7530)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
danielmai authored and aman-bansal committed Apr 7, 2021
1 parent fa5f6a9 commit 4005c66
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions x/x.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
`

Expand Down

0 comments on commit 4005c66

Please sign in to comment.