mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-08 06:16:27 +08:00
正则模式增加格式校验
This commit is contained in:
parent
7cc5269106
commit
130cc46c1a
@ -105,19 +105,19 @@ programs = {
|
|||||||
bin: '',
|
bin: '',
|
||||||
argv: '',
|
argv: '',
|
||||||
ext: 'bat',
|
ext: 'bat',
|
||||||
codec: isWin ? 'gbk' : 'utf8'
|
codec: 'gbk'
|
||||||
},
|
},
|
||||||
powershell: {
|
powershell: {
|
||||||
bin: 'powershell',
|
bin: 'powershell',
|
||||||
argv: '-NoProfile -File',
|
argv: '-NoProfile -File',
|
||||||
ext: 'ps1',
|
ext: 'ps1',
|
||||||
codec: isWin ? 'gbk' : 'utf8'
|
codec: isWin ? 'gbk' : ''
|
||||||
},
|
},
|
||||||
python: {
|
python: {
|
||||||
bin: 'python',
|
bin: 'python',
|
||||||
argv: '-u',
|
argv: '-u',
|
||||||
ext: 'py',
|
ext: 'py',
|
||||||
codec: isWin ? 'gbk' : 'utf8'
|
codec: isWin ? 'gbk' : ''
|
||||||
},
|
},
|
||||||
javascript: {
|
javascript: {
|
||||||
bin: 'node',
|
bin: 'node',
|
||||||
@ -576,7 +576,7 @@ $("#options").on('click', '#icon, #iconame', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 保存
|
// 保存
|
||||||
$("#options").on('click', '.saveBtn', function () {
|
$("#options").on('click', '.saveBtn', async function () {
|
||||||
var type = $('#type').val();
|
var type = $('#type').val();
|
||||||
var code = $("#code").val();
|
var code = $("#code").val();
|
||||||
if (!code) {
|
if (!code) {
|
||||||
@ -633,16 +633,21 @@ $("#options").on('click', '.saveBtn', function () {
|
|||||||
var rule = $('#rule').val();
|
var rule = $('#rule').val();
|
||||||
if (type == 'key') {
|
if (type == 'key') {
|
||||||
cmds = rule.split(',')
|
cmds = rule.split(',')
|
||||||
|
} else if (type == 'regex') {
|
||||||
|
if (rule[0] != '/' || rule[rule.length - 1] != '/') {
|
||||||
|
await Swal.fire({
|
||||||
|
icon: 'info',
|
||||||
|
text: '亲,是不是忘了正则表达式两边的"/"了?正确的写法是/xxxx/,不过作者会很贴心地帮你自动加上哟',
|
||||||
|
})
|
||||||
|
rule = "/" + rule + "/"
|
||||||
}
|
}
|
||||||
if (type == 'regex') {
|
|
||||||
cmds = [{
|
cmds = [{
|
||||||
"label": desc,
|
"label": desc,
|
||||||
"type": "regex",
|
"type": "regex",
|
||||||
"match": rule,
|
"match": rule,
|
||||||
"minNum": 1
|
"minNum": 1
|
||||||
}];
|
}];
|
||||||
}
|
} else if (type == 'window') {
|
||||||
if (type == 'window') {
|
|
||||||
cmds = [{
|
cmds = [{
|
||||||
"label": desc,
|
"label": desc,
|
||||||
"type": "window",
|
"type": "window",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user