From 633b30269c3f3701bfe9a2f808d11afdbb2a58df Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 29 Jan 2023 10:57:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E8=84=9A=E6=9C=AC=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/index.ts | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index ce7ac8db..dd82982a 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -152,9 +152,9 @@ export default function browserType() { shell === 'none' ? {} : { - shell, // wechat qq uc 360 2345 sougou liebao maxthon - shellVs, - }, + shell, // wechat qq uc 360 2345 sougou liebao maxthon + shellVs, + }, ); console.log( @@ -281,26 +281,25 @@ export function getCommandScript( command: string, ): [string, string] | string | undefined { const cmd = command.split(' ') as string[]; - if (cmd[0] === 'task') { - let scriptsPart = cmd.find((x) => - ['.js', '.ts', '.sh', '.py'].some((y) => x.endsWith(y)), - ); - if (!scriptsPart) return; - if (scriptsPart.startsWith('/ql/data/scripts')) { - scriptsPart = scriptsPart.replace('/ql/data/scripts/', ''); - } - - let p: string, s: string; - let index = scriptsPart.lastIndexOf('/'); - if (index >= 0) { - s = scriptsPart.slice(index + 1); - p = scriptsPart.slice(0, index); - } else { - s = scriptsPart; - p = ''; - } - return [s, p]; - } else if (cmd[1] === 'repo') { + if (cmd[1] === 'repo' || cmd[1] === 'raw') { return cmd[2]; } + let scriptsPart = cmd.find((x) => + ['.js', '.ts', '.sh', '.py'].some((y) => x.endsWith(y)), + ); + if (!scriptsPart) return; + if (scriptsPart.startsWith('/ql/data/scripts')) { + scriptsPart = scriptsPart.replace('/ql/data/scripts/', ''); + } + + let p: string, s: string; + let index = scriptsPart.lastIndexOf('/'); + if (index >= 0) { + s = scriptsPart.slice(index + 1); + p = scriptsPart.slice(0, index); + } else { + s = scriptsPart; + p = ''; + } + return [s, p]; }