summaryrefslogtreecommitdiff
path: root/cli_args.go
diff options
context:
space:
mode:
Diffstat (limited to 'cli_args.go')
-rw-r--r--cli_args.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/cli_args.go b/cli_args.go
index e42d9ae..e8fab75 100644
--- a/cli_args.go
+++ b/cli_args.go
@@ -36,11 +36,19 @@ var flagSet *flag.FlagSet
// prefixOArgs transform options passed via "-o foo,bar" into regular options
// like "-foo -bar" and prefixes them to the command line.
+// Testcases in TestPrefixOArgs().
func prefixOArgs(osArgs []string) []string {
- // Need at least 3, example: gocryptfs -o foo,bar
+ // Need at least 3, example: gocryptfs -o foo,bar
+ // ^ 0 ^ 1 ^ 2
if len(osArgs) < 3 {
return osArgs
}
+ // Passing "--" disables "-o" parsing. Ignore element 0 (program name).
+ for _, v := range osArgs[1:] {
+ if v == "--" {
+ return osArgs
+ }
+ }
// Find and extract "-o foo,bar"
var otherArgs, oOpts []string
for i := 1; i < len(osArgs); i++ {