URLInfo command 추가
This commit is contained in:
parent
d4065ae285
commit
5e0e5cf62b
4 changed files with 83 additions and 0 deletions
|
|
@ -78,6 +78,7 @@ enum CommandType {
|
|||
StringReplace,
|
||||
StringReplacePattern,
|
||||
StringIndex,
|
||||
URLInfo,
|
||||
Jira,
|
||||
Zip,
|
||||
Shell,
|
||||
|
|
@ -146,6 +147,7 @@ abstract class Command {
|
|||
CommandType.StringReplace: () => StringReplace(),
|
||||
CommandType.StringReplacePattern: () => StringReplacePattern(),
|
||||
CommandType.StringIndex: () => StringIndex(),
|
||||
CommandType.URLInfo: ()=> URLInfo(),
|
||||
CommandType.Jira: () => Jira(),
|
||||
CommandType.Zip: () => Zip(),
|
||||
CommandType.Shell: () => Shell(),
|
||||
|
|
|
|||
|
|
@ -84,3 +84,32 @@ class StringIndex extends Command {
|
|||
}
|
||||
}
|
||||
|
||||
class URLInfo extends Command {
|
||||
@override
|
||||
Future execute(DataCommand command) async {
|
||||
var data = DataURLInfo.fromJson(getParam(command));
|
||||
var uri = Uri.parse(data.url);
|
||||
|
||||
if(data.setScheme != null) {
|
||||
await setProperty(data.setScheme!, uri.scheme, showPrint: data.showPrint);
|
||||
}
|
||||
if(data.setHost != null) {
|
||||
await setProperty(data.setHost!, uri.host, showPrint: data.showPrint);
|
||||
}
|
||||
if(data.setPort != null) {
|
||||
await setProperty(data.setPort!, uri.port, showPrint: data.showPrint);
|
||||
}
|
||||
if(data.setPath != null) {
|
||||
await setProperty(data.setPath!, uri.path, showPrint: data.showPrint);
|
||||
}
|
||||
if(data.setQuery != null) {
|
||||
await setProperty(data.setQuery!, uri.query, showPrint: data.showPrint);
|
||||
}
|
||||
if(data.setFragment != null) {
|
||||
await setProperty(data.setFragment!, uri.fragment, showPrint: data.showPrint);
|
||||
}
|
||||
|
||||
return await complete(0, command);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -986,6 +986,25 @@ class DataStringIndex extends DataParam {
|
|||
Map<String, dynamic> toJson() => _$DataStringIndexToJson(this);
|
||||
}
|
||||
|
||||
//String Find Index
|
||||
@JsonSerializable()
|
||||
class DataURLInfo extends DataParam {
|
||||
DataURLInfo();
|
||||
|
||||
late String url;
|
||||
late String? setScheme; // https
|
||||
late String? setHost; // example.com
|
||||
late String? setPort; // 8080
|
||||
late String? setPath; // /path/to/resource
|
||||
late String? setQuery; // query=123
|
||||
late String? setFragment; // #section
|
||||
|
||||
factory DataURLInfo.fromJson(Map<String, dynamic> json) =>
|
||||
_$DataURLInfoFromJson(json);
|
||||
@override
|
||||
Map<String, dynamic> toJson() => _$DataURLInfoToJson(this);
|
||||
}
|
||||
|
||||
|
||||
//Web String Replace Item
|
||||
@JsonSerializable()
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ const _$CommandTypeEnumMap = {
|
|||
CommandType.StringReplace: 'StringReplace',
|
||||
CommandType.StringReplacePattern: 'StringReplacePattern',
|
||||
CommandType.StringIndex: 'StringIndex',
|
||||
CommandType.URLInfo: 'URLInfo',
|
||||
CommandType.Jira: 'Jira',
|
||||
CommandType.Zip: 'Zip',
|
||||
CommandType.Shell: 'Shell',
|
||||
|
|
@ -1668,6 +1669,38 @@ Map<String, dynamic> _$DataStringIndexToJson(DataStringIndex instance) =>
|
|||
'setValue': instance.setValue,
|
||||
};
|
||||
|
||||
DataURLInfo _$DataURLInfoFromJson(Map<String, dynamic> json) => DataURLInfo()
|
||||
..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?
|
||||
..url = json['url'] as String
|
||||
..setScheme = json['setScheme'] as String?
|
||||
..setHost = json['setHost'] as String?
|
||||
..setPort = json['setPort'] as String?
|
||||
..setPath = json['setPath'] as String?
|
||||
..setQuery = json['setQuery'] as String?
|
||||
..setFragment = json['setFragment'] as String?;
|
||||
|
||||
Map<String, dynamic> _$DataURLInfoToJson(DataURLInfo instance) =>
|
||||
<String, dynamic>{
|
||||
'workspace': instance.workspace,
|
||||
'passExitCodes': instance.passExitCodes,
|
||||
'setResult': instance.setResult,
|
||||
'setExitCode': instance.setExitCode,
|
||||
'showPrint': instance.showPrint,
|
||||
'url': instance.url,
|
||||
'setScheme': instance.setScheme,
|
||||
'setHost': instance.setHost,
|
||||
'setPort': instance.setPort,
|
||||
'setPath': instance.setPath,
|
||||
'setQuery': instance.setQuery,
|
||||
'setFragment': instance.setFragment,
|
||||
};
|
||||
|
||||
DataStringReplacePair _$DataStringReplacePairFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
DataStringReplacePair()
|
||||
|
|
|
|||
Loading…
Reference in a new issue