diff --git a/install.sh b/install.sh index 5fc9f16..a49f032 100644 --- a/install.sh +++ b/install.sh @@ -3,17 +3,19 @@ CPU_TYPE=$(uname -m) if [ $CPU_TYPE == "x86_64" ]; then - sudo wget -O /usr/local/bin/bj https://github.com/TriangleYJ/BJShell/releases/latest/download/bjshell-linux-x64 - sudo chmod +x /usr/local/bin/bj + sudo wget -O /usr/local/bin/bj https://github.com/TriangleYJ/BJShell/releases/latest/download/bjshell-linux-x64 && + sudo chmod +x /usr/local/bin/bj || + exit 1 elif [ $CPU_TYPE == "aarch64_be" ] || [ $CPU_TYPE == "aarch64" ] || [ $CPU_TYPE == "armv8b" ] || [ $CPU_TYPE == "armv8l" ]; then - sudo wget -O /usr/local/bin/bj https://github.com/TriangleYJ/BJShell/releases/latest/download/bjshell-linux-arm64 - sudo chmod +x /usr/local/bin/bj + sudo wget -O /usr/local/bin/bj https://github.com/TriangleYJ/BJShell/releases/latest/download/bjshell-linux-arm64 && + sudo chmod +x /usr/local/bin/bj || + exit 1 else echo "Install failed, not support $CPU_TYPE CPU." exit 1 fi -cat << EOF > /usr/local/bin/bjt +cat << EOF > /usr/local/bin/bjt && tmux new-session -d -s bjshell \; \ split-window -v -p 25 \; \ select-pane -t 0 \; \ @@ -26,8 +28,7 @@ tmux new-session -d -s bjshell \; \ send-keys "bj" C-m \; \ attach-session -t bjshell EOF -sudo chmod +x /usr/local/bin/bjt - -echo "Install success, you can use bj command to run BJShell." -echo "Use bjt command to run BJShell with tmux. (optional, type \`term on\` to enable terminal mode)" - +sudo chmod +x /usr/local/bin/bjt && +echo "Install success, you can use bj command to run BJShell." && +echo "Use bjt command to run BJShell with tmux. (optional, type \`term on\` to enable terminal mode)" || +exit 1 diff --git a/src/shell/commands/term.ts b/src/shell/commands/term.ts index 66666b0..90a63e8 100644 --- a/src/shell/commands/term.ts +++ b/src/shell/commands/term.ts @@ -1,4 +1,5 @@ import { BJShell } from "@/shell"; +import conf from "@/config" import { saveToLocal } from "@/storage/localstorage"; export default function term(that: BJShell, arg: string[]) { @@ -12,10 +13,15 @@ export default function term(that: BJShell, arg: string[]) { if (arg[0] == "on") { await saveToLocal("openProbCmd", "tmux send-keys -t 1 'q' C-m 'less {}' C-m"); await saveToLocal("openAnsCmd", "tmux send-keys -t 0 ':e {}' C-m"); + console.log("터미널 모드를 실행했습니다. 문제 파일과 답안 파일을 열때 아래 명령어로 실행합니다. (`{}`는 파일명이 들어갈 자리입니다)") + console.log("문제 파일: tmux send-keys -t 1 'q' C-m 'less {}' C-m"); + console.log("답안 파일: tmux send-keys -t 0 ':e {}' C-m"); + console.log(`수정을 원할 시 ${conf.CONFPATH} 에서 openProbCmd와 openAnsCmd를 수정하세요.` ) } else if(arg[0] == "off") { await saveToLocal("openProbCmd", undefined); await saveToLocal("openAnsCmd", undefined); + console.log("터미널 모드를 종료했습니다. VSCode에서 정상적으로 이용 가능합니다.") } } } \ No newline at end of file