Skip to content

Commit

Permalink
Add message on term cmd, fix install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
TriangleYJ committed Feb 5, 2024
1 parent a0fa0b3 commit 23a9f63
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
21 changes: 11 additions & 10 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \; \
Expand All @@ -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
6 changes: 6 additions & 0 deletions src/shell/commands/term.ts
Original file line number Diff line number Diff line change
@@ -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[]) {
Expand All @@ -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에서 정상적으로 이용 가능합니다.")
}
}
}

0 comments on commit 23a9f63

Please sign in to comment.