diff --git a/hyperterm/core/status.sh b/hyperterm/core/status.sh index d5f5dc5..c9b0b64 100644 --- a/hyperterm/core/status.sh +++ b/hyperterm/core/status.sh @@ -1,25 +1,14 @@ #!/bin/bash # System Status -function exitstatus(){ - local retval=$? +function exitstatus() { + local retval=$1 unset status - - # Import colors _colors_bash "$@" case $retval in - 0) - status="[${retval}]" - printf '%b%s' "${BOLD}${CYAN}" "${status}" - ;; - 1) - status="[${retval}]" - printf '%b%s' "${BOLD}${PURPLE}" "${status}" - ;; - *) - status="[${retval}]" - printf '%b%s' "${BOLD}${RED}" "${status}" - ;; + 0) status="[${retval}]"; printf '%b%s' "${BOLD}${CYAN}" "${status}" ;; + 1) status="[${retval}]"; printf '%b%s' "${BOLD}${PURPLE}" "${status}" ;; + *) status="[${retval}]"; printf '%b%s' "${BOLD}${RED}" "${status}" ;; esac } diff --git a/hyperterm/hyperterm.sha512 b/hyperterm/hyperterm.sha512 index 1424387..aeb3585 100644 --- a/hyperterm/hyperterm.sha512 +++ b/hyperterm/hyperterm.sha512 @@ -6,14 +6,14 @@ b760a908a3f6222b974abc1f7464bde0f5427f120f1e7ef1c6d97ae61769e552ef3b5cb88e193e95 f3e00b2aa8ab9f3ab44570adaa2520408ed66fd00f551654d60b64a4be3546ec781b7efa39bcd774937e654b6ffb4c7af3f21eeb36caf9c01f82f85cf28e2b4d ./core/languages.sh fdc570118a65a2b00571fd374be1aa983d41e9722bee6e604e2b00fcd2e1931df4dfd8951f15a2402dfcb3cbc76a5fe8d9d564a83fec73595dcaae2e38ac338a ./core/autodep.sh 7447d3e167ab207d3ef4218e201a06bf5a3fc23281639f16f7f405f1d66b73923845d450fdb0a94672757866a9da0324f728564a1b61b2ed1678fe576eb565cf ./core/autocomplete.sh -065cfa39f1b4312ed275ad1039827a24f703176c653a8d27303d145f9d389a60ec5b3a9eb167e060cc6fd093b9c03cfb1a8b70254d444fbc6e62e2297d88b310 ./core/status.sh -c6c149704883ce5cbbd941019259effb105dd6910c98910782024311b3362df2e68d03c947908d40686c2620c1521aeee2ffb019a906ad367be1cc3d429ecd82 ./themes/minterm.sh -0b6705dae598dff024fc10fd9c4710a298e7d2ab7b7f3895eb8654d1ad7236a0b0f72511f1db7df8155f32aa882ac2bf55a9d6a04c227ed6285b866ec3a29904 ./themes/simple.sh -1d70b22277aa1d37e770f952411687c30d47da8caae278e431208671af239591d259258b4982ca9b61faf57f266958a002180496b0db036a94250604212aa1bb ./themes/pure.sh -074e8549d638dee7470583c04ebbb7408181974806bd5e2cf5fc134ddee83c01040ed9d59a8aa00a87287b25df1c2e23edf3c063426952a8aeb56db8310ef8fd ./themes/joy.sh -403fe028575baa22c39dd11ac56a246369b8e38524c216f6d564b59aa22c60a426941f755ad3adb75f212c9124350ce3aeb114ba365ded1ed33b62ac480a60aa ./themes/light_theme.sh -7efe3770a629d6168b1c9007f420d2d657fa38fc1673dd5dc365dcf3c9d4c34456e346f9ed739c347133f93ad78cf88d0d54fe95523ce5d91a51cd49650d7525 ./themes/special.sh -07bb7b6bd609e855d0a7c9e39a0ff2959851f559106e8f59816312f298b03e87f39e53430869ed61a1271e265e976ea6b56f7ccee46c4ec3c37b40f1fc11cfad ./themes/default.sh +99f9e937e39495f60495bc89f055f29e1bee25911c9bea5c8b2a7c6a5bdc417502f17da8cb9e63ea957eea9337c6fe1c63c208a3ff3ed33ef2ca8c1dbe328599 ./core/status.sh +b28468a64d0aba42397586f8953e70bc57ad11870f48a71f842a36a91cf5924302ebd5c9b7ab303a394448ec84360747cef284fd4456d46a16d8534933628c43 ./themes/minterm.sh +7396276fa160d335de63033ca83550a8860f297af40bad781aa1b948f9ba1b04bb36595362e7b34cb1e9eaf8b1505d1efb4d1be9230c28c5edc33644c5e8743f ./themes/simple.sh +ae187c2cfd152a5b9d4c224fb2d103f7dd9ddffcbcf4efc2b9f0bf98f43ad2bc3bf705d92f8c313c910f6b6f88426c2834c416c85711231fec2b6ae46b66f600 ./themes/pure.sh +1000ebc2a54a14034e0105023df7b101e0587413a1736535493ef4e68e729d7865000b234ed92513628fcd9fc636f91d3d7db681a29dec985681cd632e78d8bc ./themes/joy.sh +6a16036f6c46552b62a7497442013f901887cc6b6ea3c5df3257c88d1776cea28a078f5b79df90824678ac3a365eb2c9edbb768a959a157be4b7f8313d31f6ce ./themes/light_theme.sh +e14662b1cfbc8a92bf4ec3ea165882e784df2571092ac436bab6f5d451f7a10a7ef4d1058a6fc49f494f1c925648edb8e708da7709c7a50619d463a92d282612 ./themes/special.sh +05e10c745d14f8246c3fda0ca4ddf3ea8406407b1fe5aad9b7703a54dd7d465dc94eaac4febfac2ec816fbc1107ceb38fe5196761a1984d3e489ec4d146a89a0 ./themes/default.sh f760432c3d76befad30588299eb2d1412d77b22fd850ffbd840c72123885d4e916a7e0b16e7048c5dcd6e58fa3bc0807cda18ae64045a7495684ba37109e4b4a ./tools/compress.sh 1b9c148ab8577fe15b4d503ec480b36eeaea42bf7048e35a0866280ee87a6c8de31c54600a8e455147db987e7aa61c8aa585748a9945c0472992d28fdccb8c0f ./tools/export.sh 8606294d403c5fd9cd5c316401387b5aea79de1d193aa9f23210c94bf32ff83e8d9dc98466d017bc4d9d037cf548335fde1b2f2631e3597a87eec7ccb8e78d6c ./tools/network.sh diff --git a/hyperterm/themes/default.sh b/hyperterm/themes/default.sh index 8d2f026..ad54aed 100644 --- a/hyperterm/themes/default.sh +++ b/hyperterm/themes/default.sh @@ -1,11 +1,17 @@ #!/bin/bash -# shellcheck disable=SC1117 +# shellcheck disable=SC1117,SC2154 unset default # Import colors _colors_bash "$@" +PROMPT_COMMAND=' + last_status=$? + ps1_status="$(exitstatus "$last_status")" + ps1_git="$(__prompt_git)" +' + default=("\n\ \[$RESET\]\ \[${BOLD}${YELLOW}\][ \u \ @@ -13,8 +19,8 @@ default=("\n\ \[${BOLD}${RED}\] \D{%I:%M%p} ]\n\ \[$RESET\]\ \[${BOLD}${WHITE}\][\$PWD]\[$RESET\] \ -\$(exitstatus)\[$RESET\]\ -\$(__prompt_git)\ +\${ps1_status}\[$RESET\]\ +\${ps1_git}\ \n\[${BOLD}${GREEN}\]$SYMBOL \[$RESET\]") export default diff --git a/hyperterm/themes/joy.sh b/hyperterm/themes/joy.sh index 0f5e8ee..7b37941 100644 --- a/hyperterm/themes/joy.sh +++ b/hyperterm/themes/joy.sh @@ -1,10 +1,17 @@ #!/bin/bash +# shellcheck disable=SC2154 unset joy # Import colors _colors_bash "$@" +PROMPT_COMMAND=' + last_status=$? + ps1_status="$(exitstatus "$last_status")" + ps1_git="$(__prompt_git)" +' + : "${joy:=\n\ \[${BOLD}${CYAN}\]\342\224\214\342\224\200[\ \[${BOLD}${YELLOW}\]\u\ @@ -15,10 +22,10 @@ _colors_bash "$@" \[${RESET}\]\w\ \[${BOLD}${CYAN}\]]\ \342\224\200\ -\$(exitstatus)\ +\${ps1_status}\ \[${BOLD}${CYAN}\]\ \342\224\200\ -\$(__prompt_git)\ +\${ps1_git}\ \[${BOLD}${CYAN}\]\342\224\200[\ \[${RESET}\]\t\ \[${BOLD}${CYAN}\]]\n\ diff --git a/hyperterm/themes/light_theme.sh b/hyperterm/themes/light_theme.sh index c269aaa..421c511 100644 --- a/hyperterm/themes/light_theme.sh +++ b/hyperterm/themes/light_theme.sh @@ -1,19 +1,26 @@ #!/bin/bash +# shellcheck disable=SC2154 unset light_theme # Import colors _colors_bash "$@" +PROMPT_COMMAND=' + last_status=$? + ps1_status="$(exitstatus "$last_status")" + ps1_git="$(__prompt_git)" +' + : "${light_theme:=\n\ \[$RESET\]\ \[${BOLD}${CYAN}\]┌─\[$RESET\]\ \[${BOLD}${YELLOW}\]\u\[$RESET\]\ \[${BOLD}${CYAN}\]@\[$RESET\]\ \[${BOLD}${GREY}\]\h\[$RESET\] \ -\$(exitstatus)\[$RESET\] \ +\${ps1_status}\[$RESET\] \ \[${BOLD}${WHITE}\][\$PWD]\ -\$(__prompt_git)\ +\${ps1_git}\ \n\[${BOLD}${CYAN}\]╰─➤\[${BOLD}${GREEN}\]$SYMBOL \[$RESET\]}" unset _psi diff --git a/hyperterm/themes/minterm.sh b/hyperterm/themes/minterm.sh index 139094a..67f417c 100644 --- a/hyperterm/themes/minterm.sh +++ b/hyperterm/themes/minterm.sh @@ -1,20 +1,28 @@ #!/bin/bash +# shellcheck disable=SC2154 unset minterm # Import colors _colors_bash "$@" +PROMPT_COMMAND=' + last_status=$? + ps1_status="$(exitstatus "$last_status")" + ps1_git="$(__prompt_git)" + ps1_time="$(printf "%b%s" "${BOLD}${GREY}" "$(date +%H:%M)")" +' + : "${minterm:=\n\ \[${BOLD}${CYAN}\]┌─\ \[${BOLD}${YELLOW}\]\u\ \[${BOLD}${CYAN}\]@\ \[${BOLD}${GREY}\]\h\[$RESET\] \ -\$(exitstatus)\[$RESET\] \ +\${ps1_status}\[$RESET\] \ \[${BOLD}${WHITE}\][\$PWD]\ -\$(__prompt_git)\n\ +\${ps1_git}\n\ \[${BOLD}${CYAN}\]╰─➤\[$RESET\] \ -\$( echo -n \"\[${BOLD}${GREY}\]\$(date +%H:%M)\" )\[$RESET\] \ +\${ps1_time}\[$RESET\] \ \[${BOLD}${GREEN}\]$SYMBOL \[$RESET\]}" unset _psi diff --git a/hyperterm/themes/pure.sh b/hyperterm/themes/pure.sh index 62958de..50b9e6c 100644 --- a/hyperterm/themes/pure.sh +++ b/hyperterm/themes/pure.sh @@ -1,18 +1,26 @@ #!/bin/bash +# shellcheck disable=SC2154 unset pure # Import colors _colors_bash "$@" +PROMPT_COMMAND=' + last_status=$? + ps1_status="$(exitstatus "$last_status")" + ps1_git="$(__prompt_git)" + ps1_time="$(printf "%b%s" "${BOLD}${GREY}" "$(date +%H:%M)")" +' + : "${pure:=\ \[${BOLD}${GREEN}\]\u\[$RESET\] \ \[${BOLD}${YELLOW}\][\ \[${BOLD}${RED}\]\w\ \[${BOLD}${YELLOW}\]]\[$RESET\] \ -\$(exitstatus)\[$RESET\] \ -\[${BOLD}${BLUE}\](\$(date +%H:%M:%S))\ -\$(__prompt_git)\ +\${ps1_status}\[$RESET\] \ +\${ps1_time}\ +\${ps1_git}\ \n\[${BOLD}${CYAN}\]$SYMBOL \[$RESET\]}" unset _psi diff --git a/hyperterm/themes/simple.sh b/hyperterm/themes/simple.sh index afba275..35fb7d4 100644 --- a/hyperterm/themes/simple.sh +++ b/hyperterm/themes/simple.sh @@ -1,4 +1,5 @@ #!/bin/bash +# shellcheck disable=SC2154 unset simple @@ -9,14 +10,21 @@ __time_out_command() { awk '{ print $1 }' /proc/loadavg } +PROMPT_COMMAND=' + last_status=$? + ps1_status="$(exitstatus "$last_status")" + ps1_load="$(__time_out_command)" + ps1_git="$(__prompt_git)" +' + : "${simple:=\n\ \[${RESET}\]\ \[${BOLD}${GREY}\]\ -\$(exitstatus)\[$RESET\] \ +\${ps1_status}\[$RESET\] \ \[${BOLD}${GREY}\]\ -\$(__time_out_command)\[$RESET\] \ +\${ps1_load}\[$RESET\] \ \[${BOLD}${WHITE}\]\W\[$RESET\]\ -\$(__prompt_git)\n\ +\${ps1_git}\n\ \[${BOLD}${GREEN}\]$SYMBOL \[$RESET\]}" unset _psi diff --git a/hyperterm/themes/special.sh b/hyperterm/themes/special.sh index fd58b1e..146cb62 100644 --- a/hyperterm/themes/special.sh +++ b/hyperterm/themes/special.sh @@ -1,5 +1,5 @@ #!/bin/bash -# shellcheck disable=SC1117 +# shellcheck disable=SC1117,SC2154 unset special @@ -17,17 +17,24 @@ _prompt_local_name() { esac } -special=("\n\ +PROMPT_COMMAND=' + last_status=$? + ps1_status="$(exitstatus "$last_status")" + ps1_loc="$(_prompt_local_name)" + ps1_git="$(__prompt_git)" +' + +: "${special:=\n\ \[$RESET\]\ -\[${BOLD}${YELLOW}\][$(_prompt_local_name)\ +\[${BOLD}${YELLOW}\][\${ps1_loc}\ \[$RESET\] \[${BOLD}${GREY}\]\w\ \[${BOLD}${YELLOW}\]]\[$RESET\] \ \[${BOLD}${CYAN}\]hist:\!\[$RESET\]\n\ \[${BOLD}${GREY}\]\ \D{%Y-%m-%d}@\D{%I:%M%p}\[$RESET\] \ -\$(exitstatus)\[$RESET\]\ -\$(__prompt_git)\n\ -\[${BOLD}${GREEN}\]$SYMBOL \[$RESET\]") +\${ps1_status}\[$RESET\]\ +\${ps1_git}\n\ +\[${BOLD}${GREEN}\]$SYMBOL \[$RESET\]}" export special