doctor.dart 893 Bytes
Newer Older
1 2 3 4 5 6
// Copyright 2016 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.

import 'dart:async';

7
import '../doctor.dart';
8 9 10
import '../runner/flutter_command.dart';

class DoctorCommand extends FlutterCommand {
11 12 13
  DoctorCommand() {
    argParser.addFlag('android-licenses',
      defaultsTo: false,
14
      negatable: false,
15 16 17 18
      help: 'Run the Android SDK manager tool to accept the SDK\'s licenses.',
    );
  }

19
  @override
20
  final String name = 'doctor';
21 22

  @override
23
  final String description = 'Show information about the installed tooling.';
24

25
  @override
26
  Future<FlutterCommandResult> runCommand() async {
27
    final bool success = await doctor.diagnose(androidLicenses: argResults['android-licenses']);
28
    return new FlutterCommandResult(success ? ExitStatus.success : ExitStatus.warning);
29 30
  }
}