[flutter_tools] hide all development tools (#57690)

This commit is contained in:
Jonah Williams 2020-05-27 10:10:19 -07:00 committed by GitHub
parent 43f18f36ef
commit ffc56ff735
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 10 deletions

View file

@ -89,8 +89,6 @@ Future<void> main(List<String> args) async {
EmulatorsCommand(),
FormatCommand(),
GenerateCommand(),
IdeConfigCommand(hidden: !verboseHelp),
InjectPluginsCommand(hidden: !verboseHelp),
InstallCommand(),
LogsCommand(),
MakeHostAppEditableCommand(),
@ -100,14 +98,17 @@ Future<void> main(List<String> args) async {
ScreenshotCommand(),
ShellCompletionCommand(),
TestCommand(verboseHelp: verboseHelp),
TrainingCommand(),
UpdatePackagesCommand(hidden: !verboseHelp),
UpgradeCommand(),
VersionCommand(),
SymbolizeCommand(
stdio: globals.stdio,
fileSystem: globals.fs,
),
// Development-only commands. These are always hidden,
IdeConfigCommand(),
InjectPluginsCommand(),
TrainingCommand(),
UpdatePackagesCommand(),
], verbose: verbose,
muteCommandLogging: muteCommandLogging,
verboseHelp: verboseHelp,

View file

@ -12,7 +12,7 @@ import '../runner/flutter_command.dart';
import '../template.dart';
class IdeConfigCommand extends FlutterCommand {
IdeConfigCommand({this.hidden = false}) {
IdeConfigCommand() {
argParser.addFlag(
'overwrite',
negatable: true,
@ -57,7 +57,7 @@ class IdeConfigCommand extends FlutterCommand {
'Currently, IntelliJ is the default (and only) IDE that may be configured.';
@override
final bool hidden;
final bool hidden = true;
@override
String get invocation => '${runner.executableName} $name';

View file

@ -10,7 +10,7 @@ import '../project.dart';
import '../runner/flutter_command.dart';
class InjectPluginsCommand extends FlutterCommand {
InjectPluginsCommand({ this.hidden = false }) {
InjectPluginsCommand() {
requiresPubspecYaml();
}
@ -21,7 +21,7 @@ class InjectPluginsCommand extends FlutterCommand {
final String description = 'Re-generates the GeneratedPluginRegistrants.';
@override
final bool hidden;
final bool hidden = true;
@override
Future<Set<DevelopmentArtifact>> get requiredArtifacts async => const <DevelopmentArtifact>{};

View file

@ -33,7 +33,7 @@ const Map<String, String> _kManuallyPinnedDependencies = <String, String>{
};
class UpdatePackagesCommand extends FlutterCommand {
UpdatePackagesCommand({ this.hidden = false }) {
UpdatePackagesCommand() {
argParser
..addFlag(
'force-upgrade',
@ -98,7 +98,7 @@ class UpdatePackagesCommand extends FlutterCommand {
final List<String> aliases = <String>['upgrade-packages'];
@override
final bool hidden;
final bool hidden = true;
// Lazy-initialize the net utilities with values from the context.

View file

@ -0,0 +1,24 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/globals.dart' as globals;
import 'package:process/process.dart';
import '../src/common.dart';
void main() {
test('All development tools are hidden', () async {
final String flutterBin = globals.fs.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await const LocalProcessManager().run(<String>[
flutterBin,
'-h',
'-v',
]);
expect(result.stdout, isNot(contains('ide-config')));
expect(result.stdout, isNot(contains('update-packages')));
expect(result.stdout, isNot(contains('inject-plugins')));
});
}