cmd/syncthing: Add explicit -help flag (fixes #5193) (#5197)

This commit is contained in:
Boris Rybalkin 2018-09-15 07:17:31 +01:00 committed by Jakob Borg
parent e39dafb584
commit b19885fdb3

View File

@ -252,6 +252,7 @@ type RuntimeOptions struct {
cpuProfile bool cpuProfile bool
stRestarting bool stRestarting bool
logFlags int logFlags int
showHelp bool
} }
func defaultRuntimeOptions() RuntimeOptions { func defaultRuntimeOptions() RuntimeOptions {
@ -295,6 +296,7 @@ func parseCommandLineOptions() RuntimeOptions {
flag.BoolVar(&options.doUpgrade, "upgrade", false, "Perform upgrade") flag.BoolVar(&options.doUpgrade, "upgrade", false, "Perform upgrade")
flag.BoolVar(&options.doUpgradeCheck, "upgrade-check", false, "Check for available upgrade") flag.BoolVar(&options.doUpgradeCheck, "upgrade-check", false, "Check for available upgrade")
flag.BoolVar(&options.showVersion, "version", false, "Show version") flag.BoolVar(&options.showVersion, "version", false, "Show version")
flag.BoolVar(&options.showHelp, "help", false, "Show this help")
flag.BoolVar(&options.showPaths, "paths", false, "Show configuration paths") flag.BoolVar(&options.showPaths, "paths", false, "Show configuration paths")
flag.BoolVar(&options.showDeviceId, "device-id", false, "Show the device ID") flag.BoolVar(&options.showDeviceId, "device-id", false, "Show the device ID")
flag.StringVar(&options.upgradeTo, "upgrade-to", options.upgradeTo, "Force upgrade directly from specified URL") flag.StringVar(&options.upgradeTo, "upgrade-to", options.upgradeTo, "Force upgrade directly from specified URL")
@ -381,6 +383,11 @@ func main() {
return return
} }
if options.showHelp {
flag.Usage()
return
}
if options.showPaths { if options.showPaths {
showPaths(options) showPaths(options)
return return