mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30:12 +08:00
refactor: move quests out of server
+ move quests from server/quests to ./quests + add frontend image in docker compose development
This commit is contained in:
1 parent
e54ae32960
commit
9aa9367f9e
17 files changed
+32
-18
No files matched your search
@@ -0,0 +1,42 @@
|
||||
PROMPT='%n@%m:%~%# '
|
||||
unsetopt CASE_GLOB
|
||||
setopt CHASE_LINKS
|
||||
emulate bash
|
||||
|
||||
typeset -A cmd
|
||||
|
||||
preexec() {
|
||||
export CMD_START_TIME=$(date +%s%N) # capture start time
|
||||
export CMD_NAME=$1 # capture command
|
||||
|
||||
# A list of interactive commands
|
||||
interactive_commands=("vim" "nano" "top" "ssh" "less" "zsh" "bash")
|
||||
|
||||
# Check if the command is in the list of interactive commands
|
||||
if [[ " ${interactive_commands[@]} " =~ " $1 " ]]; then
|
||||
# If it is, just execute it normally
|
||||
exec
|
||||
else
|
||||
# If it's not, execute it and redirect its output to a file
|
||||
exec > >(tee /tmp/cmd.out) 2> >(tee /tmp/cmd.error >&2)
|
||||
fi
|
||||
}
|
||||
|
||||
precmd() {
|
||||
export CMD_END_TIME=$(date +%s%N) # capture end time
|
||||
export CMD_EXIT_CODE=$? # capture exit status
|
||||
export CMD_OUTPUT_FILE=/tmp/cmd.out # read command output from file
|
||||
export CMD_ERROR_FILE=/tmp/cmd.error
|
||||
|
||||
# Now run your Node.js script with the result as an argument
|
||||
node /usr/local/lib/container/cli.js; rm /tmp/cmd.out /tmp/cmd.error 2>/dev/null
|
||||
|
||||
# Reset variables
|
||||
unset CMD_START_TIME
|
||||
unset CMD_END_TIME
|
||||
unset CMD_EXIT_CODE
|
||||
unset CMD_OUTPUT_FILE
|
||||
unset CMD_ERROR_FILE
|
||||
unset CMD_NAME
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
Once a mighty kingdom, now in darkness,
|
||||
The power of Unix lies dormant, waiting.
|
||||
To reclaim the root, the forgotten language,
|
||||
Must be learned, commands of old rekindled.
|
||||
Speak the words of power and awaken the might of Unix:
|
||||
|
||||
Unix, rise and guide me!
|
||||
Reference in new issue
Block a user