aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndré Colomb <src@andre.colomb.de>2021-11-04 08:42:55 +0100
committerGitHub <noreply@github.com>2021-11-04 08:42:55 +0100
commit41bfb7a3302ea7e751fb40a6b8b5a021a0634f2d (patch)
treed7d2a87adaf2c32864a9a8954fda3858f2abe66f /test
parent1c2e96a5ca470773bdfd176a9e84e54b168e4d09 (diff)
downloadsyncthing-41bfb7a3302ea7e751fb40a6b8b5a021a0634f2d.tar.gz
syncthing-41bfb7a3302ea7e751fb40a6b8b5a021a0634f2d.zip
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
Diffstat (limited to 'test')
-rw-r--r--test/cli_test.go8
-rw-r--r--test/override_test.go4
-rw-r--r--test/util.go2
3 files changed, 7 insertions, 7 deletions
diff --git a/test/cli_test.go b/test/cli_test.go
index f8e783893..c19d43831 100644
--- a/test/cli_test.go
+++ b/test/cli_test.go
@@ -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
diff --git a/test/override_test.go b/test/override_test.go
index a4af61bf5..b2fa14f11 100644
--- a/test/override_test.go
+++ b/test/override_test.go
@@ -199,7 +199,7 @@ func TestOverrideIgnores(t *testing.T) {
log.Println("Starting sendOnly...")
sendOnly := syncthingProcess{ // id1
instance: "1",
- argv: []string{"-home", "h1"},
+ argv: []string{"--home", "h1"},
port: 8081,
apiKey: apiKey,
}
@@ -212,7 +212,7 @@ func TestOverrideIgnores(t *testing.T) {
log.Println("Starting sendRecv...")
sendRecv := syncthingProcess{ // id2
instance: "2",
- argv: []string{"-home", "h2"},
+ argv: []string{"--home", "h2"},
port: 8082,
apiKey: apiKey,
}
diff --git a/test/util.go b/test/util.go
index 38b00a5a7..8f69dacda 100644
--- a/test/util.go
+++ b/test/util.go
@@ -542,7 +542,7 @@ func startInstance(t *testing.T, i int) *rc.Process {
p := rc.NewProcess(addr)
p.LogTo(log)
- if err := p.Start("../bin/syncthing", "-home", fmt.Sprintf("h%d", i), "-no-browser"); err != nil {
+ if err := p.Start("../bin/syncthing", "--home", fmt.Sprintf("h%d", i), "--no-browser"); err != nil {
t.Fatal(err)
}
p.AwaitStartup()