Skip to content

Commit fe49334

Browse files
committed
Rewrite some code
1 parent 102ddcf commit fe49334

3 files changed

Lines changed: 32 additions & 20 deletions

File tree

.gitattributes

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
termux-shizuku-tools/DEBIAN/postinst linguist-language=Shell
22
termux-shizuku-tools/DEBIAN/postrm linguist-language=Shell
3-
termux-shizuku-tools/data/data/com.termux/files/usr/bin/* linguist-language=Shell
4-
termux-shizuku-tools/data/data/com.termux/files/usr/shizuku/rish linguist-language=Shell
3+
termux-shizuku-tools/DEBIAN/prerm linguist-language=Shell
4+
termux-shizuku-tools/data/data/com.termux/files/usr/bin/* linguist-language=Shell

.nomedia

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

termux-shizuku-tools/data/data/com.termux/files/usr/libexec/shizuku/tst_utils.sh

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
#!/data/data/com.termux/files/usr/bin/bash
22

3-
TST_PKG="termux-shizuku-tools"
4-
TST_GH_REPO_LINK="https://github.com/AlexeiCrystal/termux-shizuku-tools"
5-
6-
SHK_NOT_INST_ERR_MSG="Error: Shizuku is not installed"
7-
SHK_UNK_CMD_ERR_MSG="Unknown command:"
8-
SHK_LAUNCH_MSG="Launching Shizuku app..."
9-
SHK_STOP_MSG="Stopping Shizuku server..."
10-
SHK_I_SH_MSG="Starting Shizuku interactive shell..."
11-
SHK_I_SH_EXIT_TIP="Type 'exit' to exit"
12-
HELP_CMD_TIP="Use 'shizuku help' for available commands"
13-
143
G='\033[0;32m'
154
R='\033[0;31m'
165
Y='\033[0;33m'
@@ -20,6 +9,30 @@ NC='\033[0m'
209
TICK="${G}${NC}"
2110
CROSS="${R}${NC}"
2211

12+
TST_PKG="termux-shizuku-tools"
13+
TST_GH_REPO_LINK="https://github.com/AlexeiCrystal/termux-shizuku-tools"
14+
15+
SHK_WEB_URL="https://shizuku.rikka.app"
16+
17+
DOTS="..."
18+
19+
SHK_NOT_INST_ERR_MSG="Error: Shizuku is not installed"
20+
SHK_UNK_CMD_ERR_MSG="Unknown command:"
21+
HELP_CMD_TIP="Use 'shizuku help' for available commands"
22+
23+
SHK_LAUNCH_MSG="Launching Shizuku app$DOTS"
24+
SHK_STOP_MSG="Stopping Shizuku server$DOTS"
25+
26+
SHK_I_SH_MSG="Starting Shizuku interactive shell$DOTS"
27+
SHK_I_SH_EXIT_TIP="Type 'exit' to exit"
28+
29+
SHK_SERV_STAT_STR_RUN=" \033[1A\033[KServer: ${TICK} Running"
30+
SHK_SERV_STAT_STR_STOP=" \033[1A\033[KServer: ${CROSS} Stopped"
31+
SHK_SERV_STAT_STR_LOADING=" Server: Loading info${DOTS}"
32+
33+
SHK_INST_STAT_STR_YES=" ${NC}Installed: ${TICK} Yes"
34+
SHK_INST_STAT_STR_NO=" ${NC}Installed: ${CROSS} No"
35+
2336
export TST_PKG \
2437
TST_GH_REPO_LINK \
2538
SHK_NOT_INST_ERR_MSG \
@@ -74,24 +87,24 @@ EOF
7487
show_status() {
7588
source "$PREFIX/libexec/shizuku/shizuku_lib.sh"
7689
echo -e "${NC} Package: ${Y}${SHK_PKG}${NC}"
77-
echo -e "${NC} Website: ${B}https://shizuku.rikka.app${NC}"
90+
echo -e "${NC} Website: ${B}$SHK_WEB_URL${NC}"
7891

7992
local installed=$(is_shk_installed)
8093

8194
if [ "$installed" = "true" ]; then
82-
echo -e "${NC} Installed: ${TICK} Yes"
95+
echo -e "$SHK_INST_STAT_STR_YES"
8396

8497
local v_code=$(get_shk_version_code)
8598
echo -e "${NC} Version: ${Y}${v_code}${NC}"
86-
echo -e " Server: Loading info..."
99+
echo -e "$SHK_SERV_STAT_STR_LOADING"
87100
local running=$(is_shk_server_running)
88101
if [ "$running" = "true" ]; then
89-
echo -e "\033[1A\033[K${NC} Server: ${TICK} Running"
102+
echo -e "$SHK_SERV_STAT_STR_RUN"
90103
else
91-
echo -e "\033[1A\033[K${NC} Server: ${CROSS} Stopped"
104+
echo -e "$SHK_SERV_STAT_STR_STOP"
92105
fi
93106
else
94-
echo -e "${NC} Installed: ${CROSS} No"
107+
echo -e "$SHK_INST_STAT_STR_NO"
95108
fi
96109

97110
}

0 commit comments

Comments
 (0)