Update Doctor command

This commit is contained in:
Tobe O 2018-07-14 18:16:14 -04:00
parent df0632d000
commit 1cc9e0b83a
3 changed files with 7 additions and 16 deletions

View file

@ -1,10 +1,10 @@
import "dart:convert"; import "dart:convert";
import "dart:io"; import "dart:io";
import "package:args/command_runner.dart"; import "package:args/command_runner.dart";
import "package:console/console.dart"; import 'package:io/ansi.dart';
import '../util.dart';
class DoctorCommand extends Command { class DoctorCommand extends Command {
final TextPen _pen = new TextPen();
@override @override
String get name => "doctor"; String get name => "doctor";
@ -23,16 +23,12 @@ class DoctorCommand extends Command {
try { try {
var git = await Process.start("git", ["--version"]); var git = await Process.start("git", ["--version"]);
if (await git.exitCode == 0) { if (await git.exitCode == 0) {
var version = await git.stdout.transform(UTF8.decoder).join(); var version = await git.stdout.transform(utf8.decoder).join();
_pen.green(); print(green.wrap("$checkmark Git executable found: v${version.replaceAll('git version', '').trim()}"))
_pen("${Icon.CHECKMARK} Git executable found: v${version.replaceAll('git version', '').trim()}");
_pen();
} else } else
throw new Exception("Git executable exit code not 0"); throw new Exception("Git executable exit code not 0");
} catch (exc) { } catch (exc) {
_pen.red(); print(red.wrap("$ballot Git executable not found"));
_pen("${Icon.BALLOT_X} Git executable not found");
_pen();
} }
} }
} }

View file

@ -6,6 +6,8 @@ import 'package:pubspec_parse/pubspec_parse.dart';
final String checkmark = ansiOutputEnabled ? '\u2713' : '[Success]'; final String checkmark = ansiOutputEnabled ? '\u2713' : '[Success]';
final String ballot = ansiOutputEnabled ? '\u2717' : '[Failure]';
Future<Pubspec> loadPubspec() { Future<Pubspec> loadPubspec() {
var file = new File('pubspec.yaml'); var file = new File('pubspec.yaml');
return file return file

View file

@ -7,8 +7,6 @@ dependencies:
# analyzer: ^0.29.0 # analyzer: ^0.29.0
args: ^1.0.0 args: ^1.0.0
code_builder: ^3.0.0 code_builder: ^3.0.0
#console: ^2.2.3
dart2_constant: ^1.0.0
dart_style: ^1.0.0 dart_style: ^1.0.0
glob: ^1.1.0 glob: ^1.1.0
homedir: ^0.0.4 homedir: ^0.0.4
@ -16,7 +14,6 @@ dependencies:
id: ^1.0.0 id: ^1.0.0
io: ^0.3.2 io: ^0.3.2
inflection: ^0.4.1 inflection: ^0.4.1
#mustache4dart: ^2.1.0
path: ^1.0.0 path: ^1.0.0
prompts: ^1.0.0 prompts: ^1.0.0
pubspec_parse: ^0.1.2 pubspec_parse: ^0.1.2
@ -25,10 +22,6 @@ dependencies:
watcher: ^0.9.7 watcher: ^0.9.7
yaml: ^2.0.0 yaml: ^2.0.0
#yamlicious: ^0.0.5 #yamlicious: ^0.0.5
dev_dependencies:
#build: ^0.7.0
#build_runner: ^0.3.0
#check_for_update: ^1.0.0
environment: environment:
sdk: ">=2.0.0-dev <3.0.0" sdk: ">=2.0.0-dev <3.0.0"
executables: executables: