fix: fix init script
This commit is contained in:
parent
703db757bc
commit
de3f5e697c
1 changed files with 7 additions and 16 deletions
23
index.ts
23
index.ts
|
@ -106,22 +106,13 @@ program
|
||||||
|
|
||||||
program.command("init").action(() => {
|
program.command("init").action(() => {
|
||||||
console.log(`${CLI_NAME}() {
|
console.log(`${CLI_NAME}() {
|
||||||
local output
|
command ${CLI_NAME} "$@" | while IFS= read -r line; do
|
||||||
output=$(command ${CLI_NAME} "$@")
|
if [[ $line == __EXEC__* ]]; then
|
||||||
local exit_code=$?
|
eval "\${line#__EXEC__}"
|
||||||
|
else
|
||||||
if [ $exit_code -eq 0 ]; then
|
echo "$line"
|
||||||
echo "$output" | while IFS= read -r line; do
|
fi
|
||||||
if [[ $line == __EXEC__* ]]; then
|
done
|
||||||
eval "\${line#__EXEC__}"
|
|
||||||
else
|
|
||||||
echo "$line"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
else
|
|
||||||
echo "$output" >&2
|
|
||||||
return $exit_code
|
|
||||||
fi
|
|
||||||
}`);
|
}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue