Repository: syncthing/syncthing
File: cmd/syncthing/main.go (Go)

Code before:
	errTooEarlyUpgrade      = fmt.Errorf("last upgrade happened less than %v ago, skipping", upgradeRetryInterval)
)

// The entrypoint struct is the main entry point for the command line parser. The
// commands and options here are top level commands to syncthing.
var entrypoint struct {
	Serve   serveOptions `cmd:"" help:"Run Syncthing"`
	Decrypt decrypt.CLI  `cmd:"" help:"Decrypt or verify an encrypted folder"`
	Cli     cli.CLI      `cmd:"" help:"Command line interface for Syncthing"`
}

// serveOptions are the options for the `syncthing serve` command.
type serveOptions struct {
	AllowNewerConfig bool   `help:"Allow loading newer than current config version"`
	Audit            bool   `help:"Write events to audit file"`
	AuditFile        string `name:"auditfile" placeholder:"PATH" help:"Specify audit file (use \"-\" for stdout, \"--\" for stderr)"`
	BrowserOnly      bool   `help:"Open GUI in browser"`
	ConfDir          string `name:"conf" placeholder:"PATH" help:"Set configuration directory (config and keys)"`
	DataDir          string `name:"data" placeholder:"PATH" help:"Set data directory (database and logs)"`
	DeviceID         bool   `help:"Show the device ID"`
	GenerateDir      string `name:"generate" placeholder:"PATH" help:"Generate key and config in specified dir, then exit"`
	GUIAddress       string `name:"gui-address" placeholder:"URL" help:"Override GUI address (e.g. \"http://192.0.2.42:8443\")"`
	GUIAPIKey        string `name:"gui-apikey" placeholder:"API-KEY" help:"Override GUI API key"`
	HideConsole      bool   `help:"Hide console window (Windows only)"`
	HomeDir          string `name:"home" placeholder:"PATH" help:"Set configuration and data directory"`
	LogFile          string `name:"logfile" default="${logFile}" placeholder:"PATH" help:"Log file name (see below)"`
	LogFlags         int    `name:"logflags" default:"${logFlags}" placeholder:"BITS" help:"Select information in log line prefix (see below)"`
	LogMaxFiles      int    `placeholder:"N" default:"${logMaxFiles}" name:"log-max-old-files" help:"Number of old files to keep (zero to keep only current)"`
	LogMaxSize       int    `placeholder:"BYTES" default:"${logMaxSize}" help:"Maximum size of any file (zero to disable log rotation)"`
	NoBrowser        bool   `help:"Do not start browser"`
	NoRestart        bool   `env:"STNORESTART" help:"Do not restart Syncthing when exiting due to API/GUI command, upgrade, or crash"`
	NoDefaultFolder  bool   `env:"STNODEFAULTFOLDER" help:"Don't create the \"default\" folder on first startup"`
	NoUpgrade        bool   `env:"STNOUPGRADE" help:"Disable automatic upgrades"`
	Paths            bool   `help:"Show configuration paths"`
	Paused           bool   `help:"Start with all devices and folders paused"`
	Unpaused         bool   `help:"Start with all devices and folders unpaused"`
	Upgrade          bool   `help:"Perform upgrade"`
	UpgradeCheck     bool   `help:"Check for available upgrade"`
	UpgradeTo        string `placeholder:"URL" help:"Force upgrade directly from specified URL"`
	Verbose          bool   `help:"Print verbose log output"`
	Version          bool   `help:"Show version"`

	// Debug options below
	DebugDBIndirectGCInterval time.Duration `env:"STGCINDIRECTEVERY" help:"Database indirection GC interval"`
	DebugDBRecheckInterval    time.Duration `env:"STRECHECKDBEVERY" help:"Database metadata recalculation interval"`
	DebugDeadlockTimeout      int           `placeholder:"SECONDS" env:"STDEADLOCKTIMEOUT" help:"Used for debugging internal deadlocks"`
	DebugGUIAssetsDir         string        `placeholder:"PATH" help:"Directory to load GUI assets from" env:"STGUIASSETS"`
	DebugPerfStats            bool          `env:"STPERFSTATS" help:"Write running performance statistics to perf-$pid.csv (Unix only)"`
	DebugProfileBlock         bool          `env:"STBLOCKPROFILE" help:"Write block profiles to block-$pid-$timestamp.pprof every 20 seconds"`
	DebugProfileCPU           bool          `help:"Write a CPU profile to cpu-$pid.pprof on exit" env:"CPUPROFILE"`
	DebugProfileHeap          bool          `env:"STHEAPPROFILE" help:"Write heap profiles to heap-$pid-$timestamp.pprof each time heap usage increases"`

Review comment (suggestion):
```suggestion
	LogFile          string `name:"logfile" default:"${logFile}" placeholder:"PATH" help:"Log file name (see below)"`
```

Code after:
	errTooEarlyUpgrade      = fmt.Errorf("last upgrade happened less than %v ago, skipping", upgradeRetryInterval)
)

// The entrypoint struct is the main entry point for the command line parser. The
// commands and options here are top level commands to syncthing.
var entrypoint struct {
	Serve   serveOptions `cmd:"" help:"Run Syncthing"`
	Decrypt decrypt.CLI  `cmd:"" help:"Decrypt or verify an encrypted folder"`
	Cli     cli.CLI      `cmd:"" help:"Command line interface for Syncthing"`
}

// serveOptions are the options for the `syncthing serve` command.
type serveOptions struct {
	AllowNewerConfig bool   `help:"Allow loading newer than current config version"`
	Audit            bool   `help:"Write events to audit file"`
	AuditFile        string `name:"auditfile" placeholder:"PATH" help:"Specify audit file (use \"-\" for stdout, \"--\" for stderr)"`
	BrowserOnly      bool   `help:"Open GUI in browser"`
	ConfDir          string `name:"conf" placeholder:"PATH" help:"Set configuration directory (config and keys)"`
	DataDir          string `name:"data" placeholder:"PATH" help:"Set data directory (database and logs)"`
	DeviceID         bool   `help:"Show the device ID"`
	GenerateDir      string `name:"generate" placeholder:"PATH" help:"Generate key and config in specified dir, then exit"`
	GUIAddress       string `name:"gui-address" placeholder:"URL" help:"Override GUI address (e.g. \"http://192.0.2.42:8443\")"`
	GUIAPIKey        string `name:"gui-apikey" placeholder:"API-KEY" help:"Override GUI API key"`
	HideConsole      bool   `help:"Hide console window (Windows only)"`
	HomeDir          string `name:"home" placeholder:"PATH" help:"Set configuration and data directory"`
	LogFile          string `name:"logfile" default:"${logFile}" placeholder:"PATH" help:"Log file name (see below)"`
	LogFlags         int    `name:"logflags" default:"${logFlags}" placeholder:"BITS" help:"Select information in log line prefix (see below)"`
	LogMaxFiles      int    `placeholder:"N" default:"${logMaxFiles}" name:"log-max-old-files" help:"Number of old files to keep (zero to keep only current)"`
	LogMaxSize       int    `placeholder:"BYTES" default:"${logMaxSize}" help:"Maximum size of any file (zero to disable log rotation)"`
	NoBrowser        bool   `help:"Do not start browser"`
	NoRestart        bool   `env:"STNORESTART" help:"Do not restart Syncthing when exiting due to API/GUI command, upgrade, or crash"`
	NoDefaultFolder  bool   `env:"STNODEFAULTFOLDER" help:"Don't create the \"default\" folder on first startup"`
	NoUpgrade        bool   `env:"STNOUPGRADE" help:"Disable automatic upgrades"`
	Paths            bool   `help:"Show configuration paths"`
	Paused           bool   `help:"Start with all devices and folders paused"`
	Unpaused         bool   `help:"Start with all devices and folders unpaused"`
	Upgrade          bool   `help:"Perform upgrade"`
	UpgradeCheck     bool   `help:"Check for available upgrade"`
	UpgradeTo        string `placeholder:"URL" help:"Force upgrade directly from specified URL"`
	Verbose          bool   `help:"Print verbose log output"`
	Version          bool   `help:"Show version"`

	// Debug options below
	DebugDBIndirectGCInterval time.Duration `env:"STGCINDIRECTEVERY" help:"Database indirection GC interval"`
	DebugDBRecheckInterval    time.Duration `env:"STRECHECKDBEVERY" help:"Database metadata recalculation interval"`
	DebugDeadlockTimeout      int           `placeholder:"SECONDS" env:"STDEADLOCKTIMEOUT" help:"Used for debugging internal deadlocks"`
	DebugGUIAssetsDir         string        `placeholder:"PATH" help:"Directory to load GUI assets from" env:"STGUIASSETS"`
	DebugPerfStats            bool          `env:"STPERFSTATS" help:"Write running performance statistics to perf-$pid.csv (Unix only)"`
	DebugProfileBlock         bool          `env:"STBLOCKPROFILE" help:"Write block profiles to block-$pid-$timestamp.pprof every 20 seconds"`
	DebugProfileCPU           bool          `help:"Write a CPU profile to cpu-$pid.pprof on exit" env:"CPUPROFILE"`
	DebugProfileHeap          bool          `env:"STHEAPPROFILE" help:"Write heap profiles to heap-$pid-$timestamp.pprof each time heap usage increases"`