Allow any variant of the help option to trigger the help
parent
bd24dc7135
commit
036bf7d2d1
|
@ -32,6 +32,7 @@ With this release the systemd configuration files for InfluxDB will use the syst
|
|||
- [#6900](https://github.com/influxdata/influxdb/pull/6900): Trim BOM from Windows Notepad-saved config files.
|
||||
- [#6938](https://github.com/influxdata/influxdb/issues/6938): Added favicon
|
||||
- [#6507](https://github.com/influxdata/influxdb/issues/6507): Refactor monitor service to avoid expvar and write monitor statistics on a truncated time interval.
|
||||
- [#6805](https://github.com/influxdata/influxdb/issues/6805): Allow any variant of the help option to trigger the help.
|
||||
|
||||
### Bugfixes
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ The commands are:
|
|||
|
||||
backup downloads a snapshot of a data node and saves it to disk
|
||||
config display the default configuration
|
||||
help display this help message
|
||||
restore uses a snapshot of a data node to rebuild a cluster
|
||||
run run node with existing configuration
|
||||
version displays the InfluxDB version
|
||||
|
|
|
@ -145,19 +145,18 @@ func (m *Main) Run(args ...string) error {
|
|||
func ParseCommandName(args []string) (string, []string) {
|
||||
// Retrieve command name as first argument.
|
||||
var name string
|
||||
if len(args) > 0 && !strings.HasPrefix(args[0], "-") {
|
||||
name = args[0]
|
||||
}
|
||||
|
||||
// Special case -h immediately following binary name
|
||||
if len(args) > 0 && args[0] == "-h" {
|
||||
name = "help"
|
||||
if len(args) > 0 {
|
||||
if !strings.HasPrefix(args[0], "-") {
|
||||
name = args[0]
|
||||
} else if args[0] == "-h" || args[0] == "-help" || args[0] == "--help" {
|
||||
// Special case -h immediately following binary name
|
||||
name = "help"
|
||||
}
|
||||
}
|
||||
|
||||
// If command is "help" and has an argument then rewrite args to use "-h".
|
||||
if name == "help" && len(args) > 1 {
|
||||
args[0], args[1] = args[1], "-h"
|
||||
name = args[0]
|
||||
if name == "help" && len(args) > 2 && !strings.HasPrefix(args[1], "-") {
|
||||
return args[1], []string{"-h"}
|
||||
}
|
||||
|
||||
// If a named command is specified then return it with its arguments.
|
||||
|
|
Loading…
Reference in New Issue