Files
sdk/pkg/dartdev/lib/dartdev.dart
T
Jaime Wren 01e079eff1 The initial dartdev pub * command - pass on all arguments from the 'dartdev pub *' invocation directly to 'pub *'.
Change-Id: Ife14cfad7634c03c41b19db68f2cb6c4b26be0cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134600
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
2020-02-13 20:43:38 +00:00

39 lines
1.3 KiB
Dart

// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. 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:args/args.dart';
import 'package:args/command_runner.dart';
import 'package:cli_util/cli_logging.dart';
import 'src/commands/create.dart';
import 'src/commands/format.dart';
import 'src/commands/pub.dart';
import 'src/core.dart';
class DartdevRunner<int> extends CommandRunner {
static const String dartdevDescription =
'A command-line utility for Dart development';
DartdevRunner(List<String> args) : super('dartdev', '$dartdevDescription.') {
final bool verbose = args.contains('-v') || args.contains('--verbose');
argParser.addFlag('verbose',
abbr: 'v', negatable: false, help: 'Show verbose output.');
addCommand(CreateCommand(verbose: verbose));
addCommand(FormatCommand(verbose: verbose));
addCommand(PubCommand(verbose: verbose));
}
@override
Future<int> runCommand(ArgResults results) async {
isVerbose = results['verbose'];
final Ansi ansi = Ansi(Ansi.terminalSupportsAnsi);
log = isVerbose ? Logger.verbose(ansi: ansi) : Logger.standard(ansi: ansi);
return await super.runCommand(results);
}
}