Last active
December 22, 2021 04:42
-
-
Save bsutton/07a57bf541c7b1804d0c3d438d2d7ae7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env dcli | |
import 'dart:io'; | |
import 'package:dcli/dcli.dart'; | |
void main(List<String> arguments) { | |
final pubspec = DartProject.fromPath('.').pubSpec; | |
final isFlutter = pubspec.dependencies.containsKey('flutter'); | |
if (isFlutter) { | |
if (which('flutter').notfound) { | |
printerr(red('Add flutter to your PATH and try again.')); | |
exit(1); | |
} | |
startFromArgs( | |
'flutter', | |
['pub', ...arguments], | |
nothrow: true, | |
progress: Progress.print(), | |
); | |
} else { | |
if (which('dart').notfound) { | |
printerr(red('Add dart to your PATH and try again.')); | |
exit(1); | |
} | |
DartSdk().runPub(args: arguments, nothrow: true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment