mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Switch flutter --version --json to be flutter --version --machine (#10627)
This commit is contained in:
parent
dbaf12b8ad
commit
37e32d5aee
@ -60,7 +60,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
|
||||
argParser.addFlag('version',
|
||||
negatable: false,
|
||||
help: 'Reports the version of this tool.');
|
||||
argParser.addFlag('json',
|
||||
argParser.addFlag('machine',
|
||||
negatable: false,
|
||||
hide: true);
|
||||
argParser.addFlag('color',
|
||||
@ -260,7 +260,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
|
||||
if (globalResults['version']) {
|
||||
flutterUsage.sendCommand('version');
|
||||
String status;
|
||||
if (globalResults['json']) {
|
||||
if (globalResults['machine']) {
|
||||
status = const JsonEncoder.withIndent(' ').convert(FlutterVersion.instance.toJson());
|
||||
} else {
|
||||
status = FlutterVersion.instance.toString();
|
||||
@ -269,8 +269,8 @@ class FlutterCommandRunner extends CommandRunner<Null> {
|
||||
return;
|
||||
}
|
||||
|
||||
if (globalResults['json']) {
|
||||
printError('The --json flag is only valid with the --version flag.');
|
||||
if (globalResults['machine']) {
|
||||
printError('The --machine flag is only valid with the --version flag.');
|
||||
throw new ProcessExit(2);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user