mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-05 16:12:20 +00:00
Merge pull request #2755 from calmh/dashconfig
Add -paths option to print config, key, database paths
This commit is contained in:
commit
5d4bfdabd6
@ -122,11 +122,6 @@ var (
|
|||||||
const (
|
const (
|
||||||
usage = "syncthing [options]"
|
usage = "syncthing [options]"
|
||||||
extraUsage = `
|
extraUsage = `
|
||||||
The default configuration directory is:
|
|
||||||
|
|
||||||
%s
|
|
||||||
|
|
||||||
|
|
||||||
The -logflags value is a sum of the following:
|
The -logflags value is a sum of the following:
|
||||||
|
|
||||||
1 Date
|
1 Date
|
||||||
@ -199,6 +194,7 @@ type RuntimeOptions struct {
|
|||||||
confDir string
|
confDir string
|
||||||
reset bool
|
reset bool
|
||||||
showVersion bool
|
showVersion bool
|
||||||
|
showPaths bool
|
||||||
doUpgrade bool
|
doUpgrade bool
|
||||||
doUpgradeCheck bool
|
doUpgradeCheck bool
|
||||||
upgradeTo string
|
upgradeTo string
|
||||||
@ -260,6 +256,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.showPaths, "paths", false, "Show configuration paths")
|
||||||
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")
|
||||||
flag.BoolVar(&options.auditEnabled, "audit", false, "Write events to audit file")
|
flag.BoolVar(&options.auditEnabled, "audit", false, "Write events to audit file")
|
||||||
flag.BoolVar(&options.verbose, "verbose", false, "Print verbose log output")
|
flag.BoolVar(&options.verbose, "verbose", false, "Print verbose log output")
|
||||||
@ -270,7 +267,7 @@ func parseCommandLineOptions() RuntimeOptions {
|
|||||||
flag.BoolVar(&options.hideConsole, "no-console", false, "Hide console window")
|
flag.BoolVar(&options.hideConsole, "no-console", false, "Hide console window")
|
||||||
}
|
}
|
||||||
|
|
||||||
longUsage := fmt.Sprintf(extraUsage, baseDirs["config"], debugFacilities())
|
longUsage := fmt.Sprintf(extraUsage, debugFacilities())
|
||||||
flag.Usage = usageFor(flag.CommandLine, usage, longUsage)
|
flag.Usage = usageFor(flag.CommandLine, usage, longUsage)
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
@ -320,6 +317,11 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if options.showPaths {
|
||||||
|
showPaths()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if options.browserOnly {
|
if options.browserOnly {
|
||||||
openGUI()
|
openGUI()
|
||||||
return
|
return
|
||||||
@ -1218,3 +1220,13 @@ func checkShortIDs(cfg *config.Wrapper) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func showPaths() {
|
||||||
|
fmt.Printf("Configuration file:\n\t%s\n\n", locations[locConfigFile])
|
||||||
|
fmt.Printf("Database directory:\n\t%s\n\n", locations[locDatabase])
|
||||||
|
fmt.Printf("Device private key & certificate files:\n\t%s\n\t%s\n\n", locations[locKeyFile], locations[locCertFile])
|
||||||
|
fmt.Printf("HTTPS private key & certificate files:\n\t%s\n\t%s\n\n", locations[locHTTPSKeyFile], locations[locHTTPSCertFile])
|
||||||
|
fmt.Printf("Log file:\n\t%s\n\n", locations[locLogFile])
|
||||||
|
fmt.Printf("GUI override directory:\n\t%s\n\n", locations[locGUIAssets])
|
||||||
|
fmt.Printf("Default sync folder directory:\n\t%s\n\n", locations[locDefFolder])
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user