From 7b2049c7698325a6a0ef965b6fb7a2fa94e3329b Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Mon, 10 Oct 2016 19:44:34 +0200 Subject: main: accept "-o" at the front AND at the end Moving "-o" to the end broke a third-party app, SiriKali. Breaking your users is bad, so let's accept "-o" anywhere. --- cli_args_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'cli_args_test.go') diff --git a/cli_args_test.go b/cli_args_test.go index 844a0b1..e1ed435 100644 --- a/cli_args_test.go +++ b/cli_args_test.go @@ -38,15 +38,24 @@ func TestPrefixOArgs(t *testing.T) { i: []string{"gocryptfs", "foo", "bar", "-o", "a,b,xxxxx"}, o: []string{"gocryptfs", "-a", "-b", "-xxxxx", "foo", "bar"}, }, + testcase{ + i: []string{"gocryptfs", "foo", "bar", "-d", "-o=a,b,xxxxx"}, + o: []string{"gocryptfs", "-a", "-b", "-xxxxx", "foo", "bar", "-d"}, + }, testcase{ i: []string{"gocryptfs", "foo", "bar", "-oooo", "a,b,xxxxx"}, o: []string{"gocryptfs", "foo", "bar", "-oooo", "a,b,xxxxx"}, }, + // https://github.com/mhogomchungu/sirikali/blob/a36d91d3e39f0c1eb9a79680ed6c28ddb6568fa8/src/siritask.cpp#L192 + testcase{ + i: []string{"gocryptfs", "-o", "rw", "--config", "fff", "ccc", "mmm"}, + o: []string{"gocryptfs", "-rw", "--config", "fff", "ccc", "mmm"}, + }, } for _, tc := range testcases { o := prefixOArgs(tc.i) if !reflect.DeepEqual(o, tc.o) { - t.Errorf("\n i=%q\nwant=%q\n got=%q", tc.i, tc.o, o) + t.Errorf("\n in=%q\nwant=%q\n got=%q", tc.i, tc.o, o) } } } -- cgit v1.2.3