mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 17:41:40 -05:00
excmds.ts: Add error handling to composite()
This commit is contained in:
parent
afab52e5dd
commit
06d79aeb82
1 changed files with 19 additions and 15 deletions
|
@ -1658,21 +1658,25 @@ export function repeat(n = 1, ...exstr: string[]) {
|
||||||
*/
|
*/
|
||||||
//#background
|
//#background
|
||||||
export async function composite(...cmds: string[]) {
|
export async function composite(...cmds: string[]) {
|
||||||
return cmds
|
try {
|
||||||
.join(" ")
|
return cmds
|
||||||
.split(";")
|
.join(" ")
|
||||||
.reduce(
|
.split(";")
|
||||||
async (_, cmd) => {
|
.reduce(
|
||||||
return cmd.split("|").reduce(
|
async (_, cmd) => {
|
||||||
async (pipedValue, cmd) => {
|
return cmd.split("|").reduce(
|
||||||
let [fn, args] = excmd_parser.parser(cmd)
|
async (pipedValue, cmd) => {
|
||||||
return fn.call({}, ...args, await pipedValue)
|
let [fn, args] = excmd_parser.parser(cmd)
|
||||||
},
|
return fn.call({}, ...args, await pipedValue)
|
||||||
"" as any,
|
},
|
||||||
)
|
"" as any,
|
||||||
},
|
)
|
||||||
null as any,
|
},
|
||||||
)
|
null as any,
|
||||||
|
)
|
||||||
|
} catch (e) {
|
||||||
|
logger.error(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//#background
|
//#background
|
||||||
|
|
Loading…
Add table
Reference in a new issue