18858: Fixes positional argument retrieval on sync-users & sync-groups.
[arvados.git] / tools / sync-users / sync-users.go
index f9f8b6046cd376d7e3b59d002168fe237066088c..45b6e96b87331d0f76a6c95b36da642d0683f91a 100644 (file)
@@ -123,8 +123,10 @@ func ParseFlags(cfg *ConfigParams) error {
        // Input file as a required positional argument
        if flags.NArg() == 0 {
                return fmt.Errorf("please provide a path to an input file")
+       } else if flags.NArg() > 1 {
+               return fmt.Errorf("please provide just one input file argument")
        }
-       srcPath := &os.Args[flags.NFlag()+1]
+       srcPath := &os.Args[len(os.Args)-1]
 
        // Validations
        if *srcPath == "" {