oto/lib/cli/commands/command_exe.dart

51 lines
1.3 KiB
Dart

import 'dart:async';
import 'dart:io';
import 'package:oto_cli/cli/cli.dart';
import 'package:oto_cli/cli/commands/command_base.dart';
import 'package:dart_framework/utils/system_util.dart';
import 'package:oto_cli/oto/application.dart';
class CommandExe extends CommandBase {
@override
Map<String, List<String>> get arguments => {
'-j': ["Used when it's a Jenkins build."],
'-t': ["This is the setup for testing."],
'-f {file path}': ["Run the yaml file to process."]
};
@override
String get name => 'exe';
@override
Future execute(List<String> parameters) {
for (var item in parameters) {
if (item == '-j') {
startJenkinsBuild(parameters.contains('-t'));
break;
}
if (item.startsWith('-f ')) {
startYaml(item.replaceFirst('-f ', ''));
break;
}
}
return simpleFuture;
}
void startJenkinsBuild(bool isTest) {
Application.instance.build(isTest);
}
void startYaml(String target) {
var file = File(target);
if (file.existsSync()) {
} else {
print(
CLI.style('There are no files in path "$target"', color: Color.red));
}
}
@override
String getDescription() {
return ':::: Read documents written in yaml to do process task.';
}
}