You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
619 B
20 lines
619 B
import { ScriptLine, define } from "./types.js" |
|
import quote from "shell-escape" |
|
|
|
type HasInSubShell = { inSubShell: (script: ScriptLine) => ScriptLine } |
|
|
|
export const cmdInSubShell = { |
|
bash: define<HasInSubShell>({ |
|
inSubShell: (script) => `echo ${quote([script])} | bash`, |
|
}), |
|
zsh: define<HasInSubShell>({ |
|
inSubShell: (script) => `echo ${quote([script])} | zsh`, |
|
}), |
|
fish: define<HasInSubShell>({ |
|
inSubShell: (script) => `fish -c ${quote([script])}`, |
|
}), |
|
powershell: define<HasInSubShell>({ |
|
inSubShell: (script) => |
|
`echo '${script.replace(/'/g, "\\'")}' | pwsh -NoProfile`, |
|
}), |
|
}
|
|
|