blob: 92ffbf21839f22174033f6f69b49cba8ae069830 [file] [log] [blame]
// 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 'dart:io';
import 'package:args/command_runner.dart';
import 'package:dart_style/src/cli/format_command.dart';
/// A simple executable wrapper around the [Command] API defined by dart_style.
/// This enables tests to spawn this executable in order to verify the output
/// it prints.
void main(List<String> arguments) async {
var runner =
CommandRunner<int>('dartfmt', 'Idiomatically format Dart source code.');
abbr: 'v', negatable: false, help: 'Show verbose help.');
verbose: arguments.contains('-v') || arguments.contains('--verbose')));
try {
await runner.runCommand(runner.parse(arguments));
} on UsageException catch (exception) {