Set return color set
This commit is contained in:
parent
7402d6a133
commit
ced52a1f2c
6 changed files with 14 additions and 11 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -53,4 +53,5 @@ release/
|
|||
.history
|
||||
.ionide
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/dart,visualstudiocode
|
||||
# End of https://www.toptal.com/developers/gitignore/api/dart,visualstudiocode
|
||||
assets/data/app_data.json
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
{"name":"OTO","version":"0.0.48","gitHash":"1d23272ea3c5ec1c18013a35b0e0fe90e6079bfa","buildDate":"2023-11-06 17:46:00"}
|
||||
|
|
@ -14,8 +14,8 @@ class CreateAppData extends Command {
|
|||
|
||||
var appData = await AppDataManager.to
|
||||
.create(data.scm, workspace, data.relativeAssetPath, data.name);
|
||||
setReturn(data.return_version, appData.version);
|
||||
setReturn(data.return_hash, appData.gitHash.substring(0, 7));
|
||||
await setReturn(data.return_version, appData.version);
|
||||
await setReturn(data.return_hash, appData.gitHash.substring(0, 7));
|
||||
return complete(0, command);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
import 'dart:io';
|
||||
import 'package:dart_framework/utils/path.dart';
|
||||
import 'package:dart_framework/utils/system_util.dart';
|
||||
import 'package:oto_cli/cli/cli.dart';
|
||||
import 'package:oto_cli/oto/application.dart';
|
||||
import 'package:oto_cli/oto/commands/build/app_data_creator.dart';
|
||||
import 'package:oto_cli/oto/commands/build/build_dart.dart';
|
||||
|
|
@ -88,14 +89,16 @@ abstract class Command {
|
|||
|
||||
static final Map<String, dynamic> _cache = <String, dynamic>{};
|
||||
|
||||
static void setReturnValue(String tag, dynamic value) {
|
||||
static Future setReturnValue(String tag, dynamic value) async {
|
||||
var match = regEx.firstMatch(tag);
|
||||
tag = match!.group(2)!;
|
||||
if (tag.startsWith('property')) {
|
||||
var key = tag.replaceFirst('property.', '');
|
||||
Application.instance.property[key] = value;
|
||||
print('=========> set return - $key : $value');
|
||||
await CLI.println('[Set Return] $key : $value',
|
||||
color: Color.yellowStrong);
|
||||
}
|
||||
return simpleFuture;
|
||||
}
|
||||
|
||||
static dynamic _getTagValue(String value) {
|
||||
|
|
@ -170,8 +173,8 @@ abstract class Command {
|
|||
return Command.replaceTagValue(raw);
|
||||
}
|
||||
|
||||
void setReturn(String tag, dynamic value) {
|
||||
Command.setReturnValue(tag, value);
|
||||
Future setReturn(String tag, dynamic value) async {
|
||||
await Command.setReturnValue(tag, value);
|
||||
}
|
||||
|
||||
Future execute(DataCommand command) async {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class GitCount extends Command {
|
|||
var process = await ProcessExecutor.start(shell, printStderr: false);
|
||||
var exitCode = await process.process.exitCode;
|
||||
var number = int.parse(process.stdoutArr.last);
|
||||
setReturn(data.result_value, number);
|
||||
await setReturn(data.result_value, number);
|
||||
|
||||
return complete(exitCode, command, errorMessage: process.stderr.toString());
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ class GitRev extends Command {
|
|||
var process = await ProcessExecutor.start(shell, printStderr: false);
|
||||
var exitCode = await process.process.exitCode;
|
||||
var hash = process.stdoutArr.last;
|
||||
setReturn(data.result_value, hash);
|
||||
await setReturn(data.result_value, hash);
|
||||
|
||||
return complete(exitCode, command, errorMessage: process.stderr.toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class JsonReader extends Command {
|
|||
var key = keys[i];
|
||||
if (temp.containsKey(key)) {
|
||||
if (i == keys.length - 1) {
|
||||
setReturn(item.to, temp[keys[i]].toString());
|
||||
await setReturn(item.to, temp[keys[i]].toString());
|
||||
break;
|
||||
} else {
|
||||
temp = temp[keys[i]];
|
||||
|
|
|
|||
Loading…
Reference in a new issue