From 68d011417d2f56a4223d3f572655433a05435651 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 5 Apr 2026 09:58:07 +0000 Subject: [PATCH] =?UTF-8?q?=E6=8A=95=E7=A8=BF:=20=E6=A8=A1=E6=8B=9Fcmd2.0?= =?UTF-8?q?=20=E2=80=94=20by=20ioo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script_library/index.json | 28 +++++- .../scripts/basic/cmd2_0_mnll1610.py | 98 +++++++++++++++++++ 2 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 script_library/scripts/basic/cmd2_0_mnll1610.py diff --git a/script_library/index.json b/script_library/index.json index 0ed5065..6a9d179 100644 --- a/script_library/index.json +++ b/script_library/index.json @@ -1,7 +1,7 @@ { "format_version": 1, - "data_version": 80, - "updated": "2026-04-05T06:46:23.849Z", + "data_version": 81, + "updated": "2026-04-05T09:58:07Z", "announcement": null, "categories": [ { @@ -1304,6 +1304,30 @@ "updated": null, "status": "active", "lines": 97 + }, + { + "id": "community_模拟cmd20__by_ioo", + "name": "模拟cmd2.0 — by ioo", + "name_en": "模拟cmd2.0 — by ioo", + "desc": "[投稿] 模拟cmd2.0 — by ioo", + "desc_en": "[投稿] 模拟cmd2.0 — by ioo", + "category": "basic", + "file": "scripts/basic/cmd2_0_mnll1610.py", + "thumbnail": null, + "version": 1, + "file_type": "py", + "author": "社区投稿", + "author_en": "社区投稿", + "tags": [ + "community", + "basic" + ], + "requires": [], + "min_app_version": "1.5.0", + "added": "2026-04-05", + "updated": null, + "status": "active", + "lines": 99 } ] } diff --git a/script_library/scripts/basic/cmd2_0_mnll1610.py b/script_library/scripts/basic/cmd2_0_mnll1610.py new file mode 100644 index 0000000..bbf1df2 --- /dev/null +++ b/script_library/scripts/basic/cmd2_0_mnll1610.py @@ -0,0 +1,98 @@ +# 欢迎使用 PythonIDE!如果觉得好用,请给个好评哦~ +# cmd简练版 +R = "" # 红 +G = "" # 绿 +Y = "" # 黄 +B = "" # 蓝 +C = "" # 青 +M = "" # 紫 +X = "" +new_l = "\n" +import json +cmd = "" +show = ">" +file={"command.com":"bin,can't see", + "io.sys":"bin,can't see", + "msdos.sys":"bin,can't see", + "ms.txt":"hello user!", + "sys.txt":"看到这个的人我祝福他幸福快乐每一天", + "thank.xz":"敢看嘛,其实是感谢使用" +} +print("DOS改版") +print("输入help以了解命令") +while True: + + cmd = input(show).strip() #del " " + if not cmd == new_l: + # help + if cmd.startswith("help"): + print("echo 打印文字,如echo hello") + print("echo on 开启提示符,echo off 关闭提示符") + print("dir显示文件") + print("type显示文件内容") + print("del可以删除文件,无需路径") + print("我自定义了文件的写入方式") + print("add file-text") + print("new file name") + print("exit 退出程序") + print("(del如果显示文件名就是删除成功)") + #echo + elif cmd.startswith("echo"): + input_str = cmd[4:].lstrip() + if input_str.startswith("on"): + show = ">" + elif input_str.startswith("off"): + show = "" + else: + print(input_str) + # exit + elif cmd == "exit": + + exit() + elif cmd=="dir": + print("file:") + + for i in list(file): + B=float('%.2f'%(len(str(file[i]))/1024)) + leng=32-len(str(i)) + print(f"- {i}"+f'%{leng}s'%(f'{B}KB')) + print("file number:"+str(len(file))) + elif cmd == "oaoa": + print("91*10086=917826") + # 在命令判断里加一段 + elif cmd.startswith("cls"): + for I in range(1): + print("\a") + elif cmd.startswith("type"): + print(file.get(cmd[5:],"无法找到此文件")) + elif cmd.startswith("del"): + if not cmd.endswith(".sys"): + if file.pop(cmd[4:],False): + + + + bool=True + else: + bool=False + print("try del file:"+cmd[4:] if bool else "cannot find or del this file") + elif cmd.startswith("add"): + try: + file[cmd[4:]]+=input(">>text") + except: + file[cmd[4:]]=input(">>text") + elif cmd.startswith("new"): + name=cmd[4:] + text=input(">>text") + file[name]=text + elif cmd.startswith("format"): + file={} + exit() + # read 命令 + elif cmd.startswith('load'): + with open("dosfile.txt", "r", encoding="utf-8") as f: + file = json.load(f) + elif cmd.startswith("save"): + with open("dosfile.txt", "w", encoding="utf-8") as f: + json.dump(file, f, ensure_ascii=False, indent=2) + else: + print(f"'{cmd}' 不是内部或外部命令,也不是可运行的程序")