update git
This commit is contained in:
parent
4b7a866b0f
commit
7d4fc1cd96
6 changed files with 87 additions and 6 deletions
|
|
@ -77,6 +77,7 @@ enum CommandType {
|
|||
Shell,
|
||||
ShellFile,
|
||||
Git,
|
||||
GitCommit,
|
||||
GitPush,
|
||||
GitCheckout,
|
||||
GitRev,
|
||||
|
|
@ -138,6 +139,7 @@ abstract class Command {
|
|||
CommandType.Shell: () => Shell(),
|
||||
CommandType.ShellFile: () => ShellFile(),
|
||||
CommandType.Git: () => Git(),
|
||||
CommandType.GitCommit: () => GitCommit(),
|
||||
CommandType.GitPush: () => GitPush(),
|
||||
CommandType.GitCheckout: () => GitCheckout(),
|
||||
CommandType.GitRev: () => GitRev(),
|
||||
|
|
|
|||
|
|
@ -19,6 +19,27 @@ class Git extends Command {
|
|||
}
|
||||
}
|
||||
|
||||
//무시가가능한 에러 무시
|
||||
class GitCommit extends Command {
|
||||
@override
|
||||
Future execute(DataCommand command) async {
|
||||
var data = DataGitCommit.fromJson(getParam(command));
|
||||
|
||||
var shell = StringBuffer(getCDPath(workspace));
|
||||
var addNewFile = data.addNewFile == null ? false : data.addNewFile!;
|
||||
var message = data.message;
|
||||
|
||||
if(addNewFile) {
|
||||
shell.write(' && git add -A && git commit -m "$message"');
|
||||
} else {
|
||||
shell.write(' && git commit -am "$message"');
|
||||
}
|
||||
|
||||
var process = await ProcessExecutor.start(shell);
|
||||
return await completeProcess(process, command);
|
||||
}
|
||||
}
|
||||
|
||||
//무시가가능한 에러 무시
|
||||
class GitPush extends Command {
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -14,8 +14,17 @@ class Shell extends Command {
|
|||
shell.write(' && $item');
|
||||
}
|
||||
|
||||
var process = await ProcessExecutor.start(shell);
|
||||
return await completeProcess(process, command);
|
||||
if(data.setMessage == null) {
|
||||
var process = await ProcessExecutor.start(shell);
|
||||
return await completeProcess(process, command);
|
||||
} else {
|
||||
var process = await ProcessExecutor.run(shell);
|
||||
var str = process.stdout.toString();
|
||||
var length = str.length;
|
||||
str = str.substring(0, length - 1);
|
||||
await setProperty(data.setMessage!, str);
|
||||
return await complete(process.exitCode, command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,12 @@ class StringReplace extends Command {
|
|||
|
||||
try
|
||||
{
|
||||
text = text.replaceAll(data.from, data.to);
|
||||
if(data.fromRegExp != null) {
|
||||
text = text.replaceAll(RegExp(data.fromRegExp!), data.to);
|
||||
}
|
||||
if(data.from != null) {
|
||||
text = text.replaceAll(data.from!, data.to);
|
||||
}
|
||||
await setProperty(data.setValue, text, showPrint: data.showPrint);
|
||||
}
|
||||
on Exception {
|
||||
|
|
|
|||
|
|
@ -551,6 +551,7 @@ class DataShell extends DataParam {
|
|||
DataShell();
|
||||
|
||||
late List<String> commands;
|
||||
late String? setMessage;
|
||||
|
||||
factory DataShell.fromJson(Map<String, dynamic> json) =>
|
||||
_$DataShellFromJson(json);
|
||||
|
|
@ -583,6 +584,20 @@ class DataGit extends DataParam {
|
|||
Map<String, dynamic> toJson() => _$DataGitToJson(this);
|
||||
}
|
||||
|
||||
//GitCommit
|
||||
@JsonSerializable()
|
||||
class DataGitCommit extends DataParam {
|
||||
DataGitCommit();
|
||||
|
||||
late bool? addNewFile;
|
||||
late String message;
|
||||
|
||||
factory DataGitCommit.fromJson(Map<String, dynamic> json) =>
|
||||
_$DataGitCommitFromJson(json);
|
||||
@override
|
||||
Map<String, dynamic> toJson() => _$DataGitCommitToJson(this);
|
||||
}
|
||||
|
||||
//GitPush
|
||||
@JsonSerializable()
|
||||
class DataGitPush extends DataParam {
|
||||
|
|
@ -873,7 +888,8 @@ class DataStringReplace extends DataParam {
|
|||
|
||||
late String text;
|
||||
late String setValue;
|
||||
late String from;
|
||||
late String? from;
|
||||
late String? fromRegExp;
|
||||
late String to;
|
||||
|
||||
factory DataStringReplace.fromJson(Map<String, dynamic> json) =>
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ const _$CommandTypeEnumMap = {
|
|||
CommandType.Shell: 'Shell',
|
||||
CommandType.ShellFile: 'ShellFile',
|
||||
CommandType.Git: 'Git',
|
||||
CommandType.GitCommit: 'GitCommit',
|
||||
CommandType.GitPush: 'GitPush',
|
||||
CommandType.GitCheckout: 'GitCheckout',
|
||||
CommandType.GitRev: 'GitRev',
|
||||
|
|
@ -967,7 +968,8 @@ DataShell _$DataShellFromJson(Map<String, dynamic> json) => DataShell()
|
|||
..setExitCode = json['setExitCode'] as String?
|
||||
..showPrint = json['showPrint'] as bool?
|
||||
..commands =
|
||||
(json['commands'] as List<dynamic>).map((e) => e as String).toList();
|
||||
(json['commands'] as List<dynamic>).map((e) => e as String).toList()
|
||||
..setMessage = json['setMessage'] as String?;
|
||||
|
||||
Map<String, dynamic> _$DataShellToJson(DataShell instance) => <String, dynamic>{
|
||||
'workspace': instance.workspace,
|
||||
|
|
@ -976,6 +978,7 @@ Map<String, dynamic> _$DataShellToJson(DataShell instance) => <String, dynamic>{
|
|||
'setExitCode': instance.setExitCode,
|
||||
'showPrint': instance.showPrint,
|
||||
'commands': instance.commands,
|
||||
'setMessage': instance.setMessage,
|
||||
};
|
||||
|
||||
DataShellFile _$DataShellFileFromJson(Map<String, dynamic> json) =>
|
||||
|
|
@ -1019,6 +1022,29 @@ Map<String, dynamic> _$DataGitToJson(DataGit instance) => <String, dynamic>{
|
|||
'commands': instance.commands,
|
||||
};
|
||||
|
||||
DataGitCommit _$DataGitCommitFromJson(Map<String, dynamic> json) =>
|
||||
DataGitCommit()
|
||||
..workspace = json['workspace'] as String?
|
||||
..passExitCodes = (json['passExitCodes'] as List<dynamic>?)
|
||||
?.map((e) => (e as num).toInt())
|
||||
.toList()
|
||||
..setResult = json['setResult'] as String?
|
||||
..setExitCode = json['setExitCode'] as String?
|
||||
..showPrint = json['showPrint'] as bool?
|
||||
..addNewFile = json['addNewFile'] as bool?
|
||||
..message = json['message'] as String;
|
||||
|
||||
Map<String, dynamic> _$DataGitCommitToJson(DataGitCommit instance) =>
|
||||
<String, dynamic>{
|
||||
'workspace': instance.workspace,
|
||||
'passExitCodes': instance.passExitCodes,
|
||||
'setResult': instance.setResult,
|
||||
'setExitCode': instance.setExitCode,
|
||||
'showPrint': instance.showPrint,
|
||||
'addNewFile': instance.addNewFile,
|
||||
'message': instance.message,
|
||||
};
|
||||
|
||||
DataGitPush _$DataGitPushFromJson(Map<String, dynamic> json) => DataGitPush()
|
||||
..workspace = json['workspace'] as String?
|
||||
..passExitCodes = (json['passExitCodes'] as List<dynamic>?)
|
||||
|
|
@ -1469,7 +1495,8 @@ DataStringReplace _$DataStringReplaceFromJson(Map<String, dynamic> json) =>
|
|||
..showPrint = json['showPrint'] as bool?
|
||||
..text = json['text'] as String
|
||||
..setValue = json['setValue'] as String
|
||||
..from = json['from'] as String
|
||||
..from = json['from'] as String?
|
||||
..fromRegExp = json['fromRegExp'] as String?
|
||||
..to = json['to'] as String;
|
||||
|
||||
Map<String, dynamic> _$DataStringReplaceToJson(DataStringReplace instance) =>
|
||||
|
|
@ -1482,6 +1509,7 @@ Map<String, dynamic> _$DataStringReplaceToJson(DataStringReplace instance) =>
|
|||
'text': instance.text,
|
||||
'setValue': instance.setValue,
|
||||
'from': instance.from,
|
||||
'fromRegExp': instance.fromRegExp,
|
||||
'to': instance.to,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue