change print
This commit is contained in:
parent
e8cde08885
commit
931a2a5de7
3 changed files with 14 additions and 12 deletions
|
|
@ -38,12 +38,12 @@ abstract class PiplineCondition extends PipelineExecutor {
|
|||
return PipelineValidateResult();
|
||||
}
|
||||
|
||||
Future printCondition(
|
||||
String syntax, String postfix, ConditionCheckResult result) async {
|
||||
Future printCondition(String syntax, String condition, String postfix,
|
||||
ConditionCheckResult result) async {
|
||||
var quotesPre = Platform.isWindows ? '^"' : '';
|
||||
var quotesLast = Platform.isWindows ? '"' : '';
|
||||
var printStr =
|
||||
'$quotesPre[$syntax] (${result.conditionValue}) : ${result.result}$postfix$quotesLast';
|
||||
'$quotesPre[$syntax] ($condition) / (${result.conditionValue}) : ${result.result} ===> $postfix$quotesLast';
|
||||
await CLI.println(printStr, color: Color.magentaStrong);
|
||||
return simpleFuture;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,8 +36,9 @@ class PipelineIf extends PiplineCondition {
|
|||
|
||||
@override
|
||||
Future execute() async {
|
||||
var result = checkCondition(data.condition!);
|
||||
await printCondition('IF', getPostfix(result.result), result);
|
||||
var condition = data.condition!;
|
||||
var result = checkCondition(condition);
|
||||
await printCondition('IF', condition, getPostfix(result.result), result);
|
||||
if (result.result) {
|
||||
await _pipelineTrue?.execute();
|
||||
} else {
|
||||
|
|
@ -49,12 +50,12 @@ class PipelineIf extends PiplineCondition {
|
|||
String getPostfix(bool condition) {
|
||||
if (condition) {
|
||||
return _pipelineTrue == null
|
||||
? ' ====> on-true not exist. Passed'
|
||||
: ' ====> Execute: on-true ';
|
||||
? 'on-true not exist. Passed'
|
||||
: 'Execute: on-true ';
|
||||
} else {
|
||||
return _pipelineFalse == null
|
||||
? ' ====> on-false not exist. Passed'
|
||||
: ' ====> Execute: on-false ';
|
||||
? 'on-false not exist. Passed'
|
||||
: 'Execute: on-false ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:dart_framework/utils/system_util.dart';
|
||||
import 'package:oto_cli/cli/cli.dart';
|
||||
import 'package:oto_cli/oto/data/pipeline_data.dart';
|
||||
import 'package:oto_cli/oto/pipeline/pipeline.dart';
|
||||
import 'package:oto_cli/oto/pipeline/pipeline_condition.dart';
|
||||
|
|
@ -29,12 +28,14 @@ class PipelineWhile extends PiplineCondition {
|
|||
|
||||
@override
|
||||
Future execute() async {
|
||||
var result = checkCondition(data.condition!);
|
||||
var condition = data.condition!;
|
||||
var result = checkCondition(condition);
|
||||
while (result.result) {
|
||||
await printCondition('While', ' ====> Execute: on-do', result);
|
||||
await printCondition('While', condition, 'Execute: on-do', result);
|
||||
await _pipelineOnDo?.execute();
|
||||
result = checkCondition(data.condition!);
|
||||
}
|
||||
await printCondition('While', condition, 'Loop escaped.', result);
|
||||
return simpleFuture;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue