Skip to content

Commit

Permalink
v0.5b1
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouxuanyi-zxy committed Feb 1, 2023
1 parent af1b276 commit e8ba224
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 11 deletions.
38 changes: 30 additions & 8 deletions Old-Driver-Tools-CLI.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Old-Driver-Tools Python Edition
# Author: zhouxuanyi-zxy
# Licence: MIT Licence
# Version: v0.4b
# Version: v0.5b1
# Language: Python
# 2023.1.3-v0.1b
# 2023.1.23-v0.2b
# 2023.1.23-v0.3b
# 2023.1.31-v0.4b

# 2023.2.1-v0.5b1
VERSION = "v0.5b1"
# 在0.4b后更改为正确的版本命名方式
import base64
import os
import sys
Expand All @@ -28,6 +30,7 @@
base64_decode_encode = "" # base64模式判断
utf_8_decode_encode = "" # UTF-8模式判断
sm2_decrypt_encrypt = "encrypt"
use_cli = "1" # 给我调试新功能时用的 1=true 0=false
user_input = "" # 用户输入

def base64_de_en(CLI_base64_input=None): # base64编/解码具体实现
Expand Down Expand Up @@ -85,26 +88,45 @@ def sm2_de_en(): # 初步框架,无法使用
print(sm2_output)

# sm2_de_en()
if __name__ == "__main__":
if __name__ == "__main__" and use_cli == "1":
CLI_input = ""
try:
if sys.argv[1] == "base64":
if sys.argv[2] == "decode":
CLI_input = sys.argv[3]
base64_decode_encode = "decode"
if sys.argv[2] == "encode":
elif sys.argv[2] == "encode":
CLI_input = sys.argv[3]
base64_decode_encode = "encode"
else:
raise IndexError()
base64_de_en(CLI_input)
elif sys.argv[1] == "utf-8":
if sys.argv[2] == "decode":
CLI_input = sys.argv[3]
utf_8_decode_encode = "decode"
if sys.argv[2] == "encode":
elif sys.argv[2] == "encode":
CLI_input = sys.argv[3]
utf_8_decode_encode = "encode"
else:
raise IndexError()
utf_8_de_en(CLI_input)
elif sys.argv[1] == "help" or sys.argv[1] == "h":
# print("\033[32m \033[0m") 模板
print("\033[32mOld-Driver-Tool Python Edition\033[0m")
print("\033[32mVersion:\033[0m",VERSION)
print("\033[32mby zhouxuanyi-zxy\033[0m")
print("用法/Usage:")
print("python Old-Driver-Tools-CLI.py [base64/utf-8] [decode/encode] [内容]")
print("帮助/help:")
print("python Old-Driver-Tools-CLI.py h")
else:
raise IndexError()
except IndexError:
print('''用法:
python Old-Driver-Tools-CLI.py [base64/utf-8] [decode/encode] [内容]
''')
print('''用法/Usage:
python Old-Driver-Tools-CLI.py [base64/utf-8] [decode/encode] [内容]
''')
print('''帮助/help:
python Old-Driver-Tools-CLI.py h
''')

16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 编/解码小工具

### 一个没事情的时候做的无聊的小工具
### 一个没事情的时候做的小工具

#### 它可以

Expand All @@ -22,7 +22,7 @@

#### TODO

1、~~加入命令行调用~~ (已基本实现)
1、~~加入命令行调用~~ (已实现)

2、支持SM2加/解密 (在了解原理和具体命令使用)

Expand All @@ -36,10 +36,20 @@ v0.4b (2023.1.31)

1、修复[base64解码]是非英文时无法直接输出结果

2、增加没有输入模式时,显示程序内命令行用法说明
2、增加没有输入编/解码模式时,显示程序内命令行用法说明

3、将pip安装缺失库后,自动重启所指向的文件名改正(所以之前测试时是怎么跑起来的?后续可能会删除自重启)

v0.5b1 (2023.2.1)

1、添加程序内命令使用帮助

2、**修正版本命名修正**

3、修复未选择编码方式时无任何提示

4、~~下个版本的版本号可能就要跳到1.x去了~~

总结:本项目技术力低下,代码稀碎,但是还会优化

使用命令行进行调用
Expand Down

0 comments on commit e8ba224

Please sign in to comment.