platform-cli/lib/src/util.dart

23 lines
690 B
Dart
Raw Normal View History

2018-07-14 21:47:49 +00:00
import 'dart:async';
import 'dart:io';
import 'package:io/ansi.dart';
import 'package:pubspec_parse/pubspec_parse.dart';
2018-07-14 22:12:12 +00:00
//import 'package:yamlicious/yamlicious.dart';
2018-07-14 21:47:49 +00:00
final String checkmark = ansiOutputEnabled ? '\u2713' : '[Success]';
2018-07-14 22:16:14 +00:00
final String ballot = ansiOutputEnabled ? '\u2717' : '[Failure]';
2018-07-14 22:35:45 +00:00
Future<Pubspec> loadPubspec([Directory directory]) {
directory ??= Directory.current;
var file = new File.fromUri(directory.uri.resolve('pubspec.yaml'));
2018-07-14 21:47:49 +00:00
return file
.readAsString()
.then((yaml) => new Pubspec.parse(yaml, sourceUrl: file.uri));
}
Future savePubspec(Pubspec pubspec) async {
2018-07-14 22:12:12 +00:00
// TODO: Save pubspec for real?
//var text = toYamlString(pubspec);
2018-07-14 22:35:45 +00:00
}