1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cli: remove flags.get_*_or variants (#8102)

This commit is contained in:
Tim Basel 2021-01-17 05:33:39 +01:00 committed by GitHub
parent 512f62b7a1
commit d16721e5b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 20 deletions

View File

@ -36,11 +36,6 @@ pub fn (flags []Flag) get_bool(name string) ?bool {
return flag.get_bool()
}
pub fn (flags []Flag) get_bool_or(name string, or_value bool) bool {
value := flags.get_bool(name) or { return or_value }
return value
}
pub fn (flag Flag) get_int() ?int {
if flag.flag != .int {
return error('$flag.name: Invalid flag type `$flag.flag`, expected `int`')
@ -53,11 +48,6 @@ pub fn (flags []Flag) get_int(name string) ?int {
return flag.get_int()
}
pub fn (flags []Flag) get_int_or(name string, or_value int) int {
value := flags.get_int(name) or { return or_value }
return value
}
pub fn (flag Flag) get_float() ?f64 {
if flag.flag != .float {
return error('$flag.name: Invalid flag type `$flag.flag`, expected `float`')
@ -70,11 +60,6 @@ pub fn (flags []Flag) get_float(name string) ?f64 {
return flag.get_float()
}
pub fn (flags []Flag) get_float_or(name string, or_value f64) f64 {
value := flags.get_float(name) or { return or_value }
return value
}
pub fn (flag Flag) get_string() ?string {
if flag.flag != .string {
return error('$flag.name: Invalid flag type `$flag.flag`, expected `string`')
@ -87,11 +72,6 @@ pub fn (flags []Flag) get_string(name string) ?string {
return flag.get_string()
}
pub fn (flags []Flag) get_string_or(name string, or_value string) string {
value := flags.get_string(name) or { return or_value }
return value
}
// parse flag value from arguments and return arguments with all consumed element removed
fn (mut flag Flag) parse(args []string, with_abbrev bool) ?[]string {
if flag.matches(args, with_abbrev) {