mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
flutter_tool: DRY up arg helpers, use new typed arg functions (#151784)
This commit is contained in:
parent
91a5b7bd9a
commit
83bfab5376
@ -1884,10 +1884,7 @@ Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and
|
|||||||
/// If no flag named [name] was added to the [ArgParser], an [ArgumentError]
|
/// If no flag named [name] was added to the [ArgParser], an [ArgumentError]
|
||||||
/// will be thrown.
|
/// will be thrown.
|
||||||
bool boolArg(String name, {bool global = false}) {
|
bool boolArg(String name, {bool global = false}) {
|
||||||
if (global) {
|
return (global ? globalResults : argResults)!.flag(name);
|
||||||
return globalResults![name] as bool;
|
|
||||||
}
|
|
||||||
return argResults![name] as bool;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the parsed command-line option named [name] as a `String`.
|
/// Gets the parsed command-line option named [name] as a `String`.
|
||||||
@ -1895,18 +1892,12 @@ Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and
|
|||||||
/// If no option named [name] was added to the [ArgParser], an [ArgumentError]
|
/// If no option named [name] was added to the [ArgParser], an [ArgumentError]
|
||||||
/// will be thrown.
|
/// will be thrown.
|
||||||
String? stringArg(String name, {bool global = false}) {
|
String? stringArg(String name, {bool global = false}) {
|
||||||
if (global) {
|
return (global ? globalResults : argResults)!.option(name);
|
||||||
return globalResults![name] as String?;
|
|
||||||
}
|
|
||||||
return argResults![name] as String?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the parsed command-line option named [name] as `List<String>`.
|
/// Gets the parsed command-line option named [name] as `List<String>`.
|
||||||
List<String> stringsArg(String name, {bool global = false}) {
|
List<String> stringsArg(String name, {bool global = false}) {
|
||||||
if (global) {
|
return (global ? globalResults : argResults)!.multiOption(name);
|
||||||
return globalResults![name] as List<String>;
|
|
||||||
}
|
|
||||||
return argResults![name] as List<String>;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user