瀏覽代碼

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

Boris Rybalkin 7 年之前
父節點
當前提交
b19885fdb3
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      cmd/syncthing/main.go

+ 7 - 0
cmd/syncthing/main.go

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