diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e2cae22 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/build/ +/dist/ diff --git a/AutozShellLauncher.py b/AutozShellLauncher.py deleted file mode 100644 index 9b569af..0000000 --- a/AutozShellLauncher.py +++ /dev/null @@ -1,20 +0,0 @@ -import os,sys - -if len(sys.argv) > 1: - try: - if not sys.argv[1] == "-c": - # 判断当前目录有没有main.py - - os.system("pip install pluginbase") - if os.path.exists("main.py"): - - os.system("python3 main.py") - else: - if os.path.exists("autozshell.zip"): - os.system("unzip autozshell.zip") - os.system("python3 main.py") - except: - pass - - if sys.argv[1] == "-c": - os.system("zip autozshell.zip *") diff --git a/__pycache__/chatmode.cpython-310.pyc b/__pycache__/chatmode.cpython-310.pyc index 1ca4555..7b7884d 100644 Binary files a/__pycache__/chatmode.cpython-310.pyc and b/__pycache__/chatmode.cpython-310.pyc differ diff --git a/ash.py b/ash.py new file mode 100644 index 0000000..d0749ff --- /dev/null +++ b/ash.py @@ -0,0 +1,2 @@ +import os +os.system("python3 main.py") \ No newline at end of file diff --git a/chatmode.py b/chatmode.py index ca4639e..03a1e4f 100644 --- a/chatmode.py +++ b/chatmode.py @@ -77,13 +77,7 @@ while True: with open(current_file_dir + "/" + "themetext", "r") as f: themetext = f.read() - # 获取当前用户和地址 - user = os.getlogin() - address = os.getcwd() - # 把inputtext这个变量里的{user}换成user变量 - inputtext = themetext.replace("{user}", user) - # 把inputtext这个变量里的{address}换成address变量 - inputtext = inputtext.replace("{address}", address) + inputtext = themetext text1 = str(input(inputtext)) if text1 == "exit": diff --git a/main.py b/main.py index 7d11ebf..4ea2100 100644 --- a/main.py +++ b/main.py @@ -1,7 +1,7 @@ import configparser import sys,os import fun -version = "1.5.0" +version = "1.5.5" config = configparser.ConfigParser() if not os.path.exists(os.path.expanduser('~') + '/.ashrc'): diff --git a/theme/default/theme.py b/theme/default/theme.py index f7ba840..52fb61d 100644 --- a/theme/default/theme.py +++ b/theme/default/theme.py @@ -1,8 +1,12 @@ +import os theme_name = "default" theme_version = "1.0.0" -head = "{user}@{address}$ " -import os +user = os.getlogin() +address = os.getcwd() +head = f"\033[31m{user}\033[0m@\033[32m{address}\033[0m$ " + + # 获取当前文件的绝对路径 current_file_path = os.path.abspath(__file__) diff --git a/theme/sus/theme.py b/theme/sus/theme.py new file mode 100644 index 0000000..3c35e23 --- /dev/null +++ b/theme/sus/theme.py @@ -0,0 +1,18 @@ +import os +theme_name = "sus" +theme_version = "1.0.0" + +user = os.getlogin() +address = os.getcwd() +head = f"\033[31mSUS的{user}\033[0m@\033[32m{address}\033[0m$ " + +# 获取当前文件的绝对路径 +current_file_path = os.path.abspath(__file__) + +# 从绝对路径中提取目录 +current_file_dir = os.path.dirname(current_file_path) +# 拼接成配置文件路径 +current_file_dir = current_file_dir.split("/") +current_file_dir = "/".join(current_file_dir[:-1]) +with open(current_file_dir + "text", "w") as f: + f.write(head) \ No newline at end of file diff --git a/themetext b/themetext index dd079d6..c0c0768 100644 --- a/themetext +++ b/themetext @@ -1 +1 @@ -{user}@{address}$ \ No newline at end of file +root@/root/PycharmProjects/autozshell$ \ No newline at end of file