Accept a subcommand as an alternative to the --generate option. It accepts a custom config directory through either the --home or --config options, using the default location if neither is given. Add the options --gui-user and --gui-password to "generate", but not the "serve --generate" option form. If either is given, an existing config will not abort the command, but rather load, modify and save it with the new credentials. The password can be read from standard input by passing only a single dash as argument. Config modification is skipped if the value matches what's already in the config. * cmd/syncthing: Utilize lib/locations package in generate(). Instead of manually joining paths with "magic" file names, get them from the centralized locations helper lib. * cmd/syncthing: Simplify logging for --generate option. Visible change: No more timestamp prefixes.
16 lines
696 B
Go
16 lines
696 B
Go
// Copyright (C) 2021 The Syncthing Authors.
|
|
//
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
package cmdutil
|
|
|
|
// CommonOptions are reused among several subcommands
|
|
type CommonOptions struct {
|
|
buildCommonOptions
|
|
ConfDir string `name:"config" placeholder:"PATH" help:"Set configuration directory (config and keys)"`
|
|
HomeDir string `name:"home" placeholder:"PATH" help:"Set configuration and data directory"`
|
|
NoDefaultFolder bool `env:"STNODEFAULTFOLDER" help:"Don't create the \"default\" folder on first startup"`
|
|
}
|