18858: Fixes positional argument retrieval on sync-users & sync-groups.
[arvados.git] / tools / sync-groups / sync-groups.go
index e1e054a663cad7d6613899ce87366ef79c4e1242..daec5c99578fd7e3de0fb73980afa3c027c53344 100644 (file)
@@ -181,8 +181,10 @@ func ParseFlags(config *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 == "" {