Skip to content

Commit

Permalink
cli: fix typo (#8742)
Browse files Browse the repository at this point in the history
  • Loading branch information
AAAA committed Feb 15, 2021
1 parent 4a0367a commit 4213851
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/cli.v
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn main() {
greet_cmd.add_flag(Flag{
flag: .string
name: 'fun'
multipe: true
multiple: true
description: 'Just a dumby flags to show multiple.'
})
cmd.add_command(greet_cmd)
Expand Down
4 changes: 2 additions & 2 deletions vlib/cli/flag.v
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub mut:
// If allow multiple value.
// If bool, multiple has no impact, bool can only set once.
// If not multiple, and multiple value set at command args, raise an error.
multipe bool
multiple bool
mut:
// Set true if flag found.
found bool
Expand Down Expand Up @@ -206,7 +206,7 @@ fn (mut flag Flag) parse(args []string, with_abbrev bool) ?[]string {
new_args := flag.parse_bool(args) ?
return new_args
} else {
if flag.value.len > 0 && !flag.multipe {
if flag.value.len > 0 && !flag.multiple {
return error('The argument `$flag.name` accept only one value!')
}

Expand Down
12 changes: 6 additions & 6 deletions vlib/cli/flag_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn test_if_string_flag_parses() {
flag = cli.Flag{
flag: .string
name: 'flag'
multipe: true
multiple: true
}
flag.parse(['-flag=value1'], false) or { panic(err) }
flag.parse(['-flag=value2'], false) or { panic(err) }
Expand All @@ -31,7 +31,7 @@ fn test_if_string_flag_parses() {
cli.Flag{
flag: .string
name: 'flag'
multipe: true
multiple: true
value: ['a', 'b', 'c']
},
cli.Flag{
Expand Down Expand Up @@ -90,7 +90,7 @@ fn test_if_int_flag_parses() {
flag = cli.Flag{
flag: .int
name: 'flag'
multipe: true
multiple: true
}

flag.parse(['-flag=42'], false) or { panic(err) }
Expand All @@ -102,7 +102,7 @@ fn test_if_int_flag_parses() {
cli.Flag{
flag: .int
name: 'flag'
multipe: true
multiple: true
value: ['1', '2', '3']
},
cli.Flag{
Expand Down Expand Up @@ -138,7 +138,7 @@ fn test_if_float_flag_parses() {
flag = cli.Flag{
flag: .float
name: 'flag'
multipe: true
multiple: true
}

flag.parse(['-flag=3.1'], false) or { panic(err) }
Expand All @@ -150,7 +150,7 @@ fn test_if_float_flag_parses() {
cli.Flag{
flag: .float
name: 'flag'
multipe: true
multiple: true
value: ['1.1', '2.2', '3.3']
},
cli.Flag{
Expand Down

0 comments on commit 4213851

Please sign in to comment.