Skip to content

Commit

Permalink
cli: fail better on V style flag parsing (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
larpon authored Sep 15, 2024
1 parent 7e7e425 commit ebbfb2c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cli/cli.v
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ pub fn input_from_args(arguments []string) (string, []string) {
opts, unmatched := options_from_arguments(args, Options{}) or { Options{}, args }
mut input := opts.input
if unmatched.len > 0 && (os.is_dir(unmatched[0]) || os.is_file(unmatched[0])) {
input = unmatched[0]
args.delete(args.index(input))
if unmatched[0] != args[0] or { '' } {
input = unmatched[0]
args.delete(args.index(input))
}
} else if opts.input != '' {
args.delete(args.index(opts.input))
}
Expand Down

0 comments on commit ebbfb2c

Please sign in to comment.