2015-10-10 06:41:40 +00:00
|
|
|
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2015-10-13 20:36:39 +00:00
|
|
|
import 'dart:async';
|
|
|
|
|
2017-11-10 05:45:31 +00:00
|
|
|
import 'runner.dart' as runner;
|
2015-11-11 18:29:05 +00:00
|
|
|
import 'src/commands/analyze.dart';
|
2015-10-10 06:41:40 +00:00
|
|
|
import 'src/commands/build.dart';
|
2016-08-25 19:16:21 +00:00
|
|
|
import 'src/commands/channel.dart';
|
2017-10-19 18:23:42 +00:00
|
|
|
import 'src/commands/clean.dart';
|
2016-04-26 23:25:11 +00:00
|
|
|
import 'src/commands/config.dart';
|
2016-01-27 22:37:29 +00:00
|
|
|
import 'src/commands/create.dart';
|
2015-11-02 21:05:05 +00:00
|
|
|
import 'src/commands/daemon.dart';
|
2016-02-14 07:50:20 +00:00
|
|
|
import 'src/commands/devices.dart';
|
2016-02-17 02:23:43 +00:00
|
|
|
import 'src/commands/doctor.dart';
|
2016-02-20 00:31:34 +00:00
|
|
|
import 'src/commands/drive.dart';
|
2016-08-31 13:40:17 +00:00
|
|
|
import 'src/commands/format.dart';
|
2017-03-14 18:12:19 +00:00
|
|
|
import 'src/commands/fuchsia_reload.dart';
|
2017-11-13 18:55:22 +00:00
|
|
|
import 'src/commands/ide_config.dart';
|
2017-12-14 01:49:54 +00:00
|
|
|
import 'src/commands/inject_plugins.dart';
|
2015-10-10 06:41:40 +00:00
|
|
|
import 'src/commands/install.dart';
|
|
|
|
import 'src/commands/logs.dart';
|
2016-08-26 02:37:48 +00:00
|
|
|
import 'src/commands/packages.dart';
|
2016-04-08 15:51:44 +00:00
|
|
|
import 'src/commands/precache.dart';
|
2016-02-14 07:50:20 +00:00
|
|
|
import 'src/commands/run.dart';
|
2016-03-25 23:04:22 +00:00
|
|
|
import 'src/commands/screenshot.dart';
|
2015-10-10 06:41:40 +00:00
|
|
|
import 'src/commands/stop.dart';
|
2015-11-05 07:43:15 +00:00
|
|
|
import 'src/commands/test.dart';
|
2015-10-10 06:41:40 +00:00
|
|
|
import 'src/commands/trace.dart';
|
2016-02-25 23:29:58 +00:00
|
|
|
import 'src/commands/update_packages.dart';
|
2015-11-12 18:13:40 +00:00
|
|
|
import 'src/commands/upgrade.dart';
|
2017-03-04 00:54:47 +00:00
|
|
|
import 'src/runner/flutter_command.dart';
|
2016-11-29 19:22:48 +00:00
|
|
|
|
2015-10-10 06:41:40 +00:00
|
|
|
/// Main entry point for commands.
|
|
|
|
///
|
2016-05-19 17:21:38 +00:00
|
|
|
/// This function is intended to be used from the `flutter` command line tool.
|
2016-03-10 02:05:05 +00:00
|
|
|
Future<Null> main(List<String> args) async {
|
2017-03-04 01:50:46 +00:00
|
|
|
final bool verbose = args.contains('-v') || args.contains('--verbose');
|
|
|
|
final bool help = args.contains('-h') || args.contains('--help') ||
|
2016-09-22 09:58:45 +00:00
|
|
|
(args.isNotEmpty && args.first == 'help') || (args.length == 1 && verbose);
|
2017-03-04 01:50:46 +00:00
|
|
|
final bool verboseHelp = help && verbose;
|
2016-01-29 22:32:12 +00:00
|
|
|
|
2017-11-10 05:45:31 +00:00
|
|
|
await runner.run(args, <FlutterCommand>[
|
2017-03-04 00:54:47 +00:00
|
|
|
new AnalyzeCommand(verboseHelp: verboseHelp),
|
|
|
|
new BuildCommand(verboseHelp: verboseHelp),
|
|
|
|
new ChannelCommand(),
|
2017-10-19 18:23:42 +00:00
|
|
|
new CleanCommand(),
|
2017-12-14 01:49:54 +00:00
|
|
|
new InjectPluginsCommand(hidden: !verboseHelp),
|
2017-07-07 23:00:45 +00:00
|
|
|
new ConfigCommand(verboseHelp: verboseHelp),
|
2017-03-04 00:54:47 +00:00
|
|
|
new CreateCommand(),
|
|
|
|
new DaemonCommand(hidden: !verboseHelp),
|
|
|
|
new DevicesCommand(),
|
|
|
|
new DoctorCommand(),
|
|
|
|
new DriveCommand(),
|
|
|
|
new FormatCommand(),
|
2017-03-14 18:12:19 +00:00
|
|
|
new FuchsiaReloadCommand(),
|
2017-11-13 18:55:22 +00:00
|
|
|
new IdeConfigCommand(hidden: !verboseHelp),
|
2017-03-04 00:54:47 +00:00
|
|
|
new InstallCommand(),
|
|
|
|
new LogsCommand(),
|
|
|
|
new PackagesCommand(),
|
|
|
|
new PrecacheCommand(),
|
|
|
|
new RunCommand(verboseHelp: verboseHelp),
|
|
|
|
new ScreenshotCommand(),
|
|
|
|
new StopCommand(),
|
2017-06-13 20:26:32 +00:00
|
|
|
new TestCommand(verboseHelp: verboseHelp),
|
2017-03-04 00:54:47 +00:00
|
|
|
new TraceCommand(),
|
|
|
|
new UpdatePackagesCommand(hidden: !verboseHelp),
|
|
|
|
new UpgradeCommand(),
|
|
|
|
], verbose: verbose, verboseHelp: verboseHelp);
|
|
|
|
}
|