Normalize CLI options to always use two dashes. (#8037)
Consistently use double dashes and fix typos -conf, -data-dir and -verify. Applies also to tests running the syncthing binary for consistency. * Fix mismatched option name --conf in cli subcommand. According to the source code comments, the cli option flags should mirror those from the serve subcommand where applicable. That one is actually called --config though. * cli: Fix help text option placeholders. The urfave/cli package uses the Value field of StringFlag to provide a default value, not to name the placeholder. That is instead done with backticks around some part of the Usage field. * cli: Add missing --data flag in subcommand help text. The urfave/cli based option parsing uses a fake flags collection to generate help texts matching the used global options. But the --data option was omitted from it, although it is definitely required when using --config as well. Note that it cannot just be ignored, as some debug stuff actually uses the DB: syncthing cli --data=/bar --config=/foo debug index dump
This commit is contained in:
+4
-4
@@ -31,7 +31,7 @@ func TestCLIReset(t *testing.T) {
|
||||
|
||||
// Run reset to clean up
|
||||
|
||||
cmd := exec.Command("../bin/syncthing", "-no-browser", "-home", "h1", "-reset-database")
|
||||
cmd := exec.Command("../bin/syncthing", "--no-browser", "--home", "h1", "--reset-database")
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stdout
|
||||
err := cmd.Run()
|
||||
@@ -63,9 +63,9 @@ func TestCLIGenerate(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// -generate should create a bunch of stuff
|
||||
// --generate should create a bunch of stuff
|
||||
|
||||
cmd := exec.Command("../bin/syncthing", "-no-browser", "-generate", "home.out")
|
||||
cmd := exec.Command("../bin/syncthing", "--no-browser", "--generate", "home.out")
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stdout
|
||||
err = cmd.Run()
|
||||
@@ -91,7 +91,7 @@ func TestCLIFirstStartup(t *testing.T) {
|
||||
|
||||
// First startup should create config, BEP certificate, and HTTP certificate.
|
||||
|
||||
cmd := exec.Command("../bin/syncthing", "-no-browser", "-home", "home.out")
|
||||
cmd := exec.Command("../bin/syncthing", "--no-browser", "--home", "home.out")
|
||||
cmd.Env = append(os.Environ(), "STNORESTART=1")
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stdout
|
||||
|
||||
Reference in New Issue
Block a user