mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fix the cli module
This commit is contained in:
parent
7e4799334f
commit
1a0b78ae2f
@ -69,10 +69,10 @@ fn (flag mut Flag) parse_raw(args []string) ?[]string {
|
||||
if args[0].len > flag.name.len && args[0].contains('=') {
|
||||
println('1')
|
||||
flag.value = args[0].split('=')[1]
|
||||
return args.right(1)
|
||||
return args[1..]
|
||||
} else if args.len >= 2 {
|
||||
flag.value = args[1]
|
||||
return args.right(2)
|
||||
return args[2..]
|
||||
}
|
||||
return error('missing argument for ${flag.name}')
|
||||
}
|
||||
@ -80,15 +80,15 @@ fn (flag mut Flag) parse_raw(args []string) ?[]string {
|
||||
fn (flag mut Flag) parse_bool(args []string) ?[]string {
|
||||
if args[0].len > flag.name.len && args[0].contains('=') {
|
||||
flag.value = args[0].split('=')[1]
|
||||
return args.right(1)
|
||||
return args[1..]
|
||||
} else if args.len >= 2 {
|
||||
if args[1] in ['true', 'false'] {
|
||||
flag.value = args[1]
|
||||
return args.right(2)
|
||||
return args[2..]
|
||||
}
|
||||
}
|
||||
flag.value = 'true'
|
||||
return args.right(1)
|
||||
return args[1..]
|
||||
}
|
||||
|
||||
fn (flags []Flag) get(name string) ?Flag {
|
||||
|
Loading…
Reference in New Issue
Block a user