pymecli 0.6.5__tar.gz → 0.6.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. pymecli-0.6.7/PKG-INFO +225 -0
  2. pymecli-0.6.7/README.md +185 -0
  3. {pymecli-0.6.5 → pymecli-0.6.7}/cli/util.py +18 -19
  4. {pymecli-0.6.5 → pymecli-0.6.7}/core/clash.py +19 -19
  5. {pymecli-0.6.5 → pymecli-0.6.7}/pyproject.toml +3 -2
  6. pymecli-0.6.5/PKG-INFO +0 -110
  7. pymecli-0.6.5/README.md +0 -71
  8. {pymecli-0.6.5 → pymecli-0.6.7}/.gitignore +0 -0
  9. {pymecli-0.6.5 → pymecli-0.6.7}/api/__init__.py +0 -0
  10. {pymecli-0.6.5 → pymecli-0.6.7}/api/v1/__init__.py +0 -0
  11. {pymecli-0.6.5 → pymecli-0.6.7}/api/v1/clash.py +0 -0
  12. {pymecli-0.6.5 → pymecli-0.6.7}/api/v1/redis.py +0 -0
  13. {pymecli-0.6.5 → pymecli-0.6.7}/cli/__init__.py +0 -0
  14. {pymecli-0.6.5 → pymecli-0.6.7}/cli/bitget.py +0 -0
  15. {pymecli-0.6.5 → pymecli-0.6.7}/cli/dnspod.py +0 -0
  16. {pymecli-0.6.5 → pymecli-0.6.7}/cli/dst.py +0 -0
  17. {pymecli-0.6.5 → pymecli-0.6.7}/cli/etcd_sync.py +0 -0
  18. {pymecli-0.6.5 → pymecli-0.6.7}/cli/example.py +0 -0
  19. {pymecli-0.6.5 → pymecli-0.6.7}/cli/fast.py +0 -0
  20. {pymecli-0.6.5 → pymecli-0.6.7}/cli/gate.py +0 -0
  21. {pymecli-0.6.5 → pymecli-0.6.7}/cli/okx.py +0 -0
  22. {pymecli-0.6.5 → pymecli-0.6.7}/cli/quark.py +0 -0
  23. {pymecli-0.6.5 → pymecli-0.6.7}/cli/redis_csv.py +0 -0
  24. {pymecli-0.6.5 → pymecli-0.6.7}/cli/tele.py +0 -0
  25. {pymecli-0.6.5 → pymecli-0.6.7}/core/__init__.py +0 -0
  26. {pymecli-0.6.5 → pymecli-0.6.7}/core/config.py +0 -0
  27. {pymecli-0.6.5 → pymecli-0.6.7}/core/redis_client.py +0 -0
  28. {pymecli-0.6.5 → pymecli-0.6.7}/crypto/__init__.py +0 -0
  29. {pymecli-0.6.5 → pymecli-0.6.7}/crypto/bitget.py +0 -0
  30. {pymecli-0.6.5 → pymecli-0.6.7}/crypto/gate.py +0 -0
  31. {pymecli-0.6.5 → pymecli-0.6.7}/crypto/okx.py +0 -0
  32. {pymecli-0.6.5 → pymecli-0.6.7}/data/__init__.py +0 -0
  33. {pymecli-0.6.5 → pymecli-0.6.7}/data/dou_dict.py +0 -0
  34. {pymecli-0.6.5 → pymecli-0.6.7}/data/dou_list.py +0 -0
  35. {pymecli-0.6.5 → pymecli-0.6.7}/data/main.py +0 -0
  36. {pymecli-0.6.5 → pymecli-0.6.7}/data/template.yaml +0 -0
  37. {pymecli-0.6.5 → pymecli-0.6.7}/models/__init__.py +0 -0
  38. {pymecli-0.6.5 → pymecli-0.6.7}/models/douzero_model.py +0 -0
  39. {pymecli-0.6.5 → pymecli-0.6.7}/models/ocr_model.py +0 -0
  40. {pymecli-0.6.5 → pymecli-0.6.7}/models/response.py +0 -0
  41. {pymecli-0.6.5 → pymecli-0.6.7}/utils/__init__.py +0 -0
  42. {pymecli-0.6.5 → pymecli-0.6.7}/utils/elapsed.py +0 -0
  43. {pymecli-0.6.5 → pymecli-0.6.7}/utils/etcd.py +0 -0
  44. {pymecli-0.6.5 → pymecli-0.6.7}/utils/helper.py +0 -0
  45. {pymecli-0.6.5 → pymecli-0.6.7}/utils/logger.py +0 -0
  46. {pymecli-0.6.5 → pymecli-0.6.7}/utils/mysql.py +0 -0
  47. {pymecli-0.6.5 → pymecli-0.6.7}/utils/notify.py +0 -0
  48. {pymecli-0.6.5 → pymecli-0.6.7}/utils/path.py +0 -0
  49. {pymecli-0.6.5 → pymecli-0.6.7}/utils/pd.py +0 -0
  50. {pymecli-0.6.5 → pymecli-0.6.7}/utils/pyredis.py +0 -0
  51. {pymecli-0.6.5 → pymecli-0.6.7}/utils/sendNotify.py +0 -0
  52. {pymecli-0.6.5 → pymecli-0.6.7}/utils/sleep.py +0 -0
  53. {pymecli-0.6.5 → pymecli-0.6.7}/utils/text.py +0 -0
  54. {pymecli-0.6.5 → pymecli-0.6.7}/utils/toml.py +0 -0
pymecli-0.6.7/PKG-INFO ADDED
@@ -0,0 +1,225 @@
1
+ Metadata-Version: 2.5
2
+ Name: pymecli
3
+ Version: 0.6.7
4
+ Summary: My CLI
5
+ Project-URL: Homepage, https://pypi.org/project/pymecli
6
+ Project-URL: Repository, https://github.com/meme2046/pymecli
7
+ License: MIT
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Requires-Python: >=3.10
12
+ Requires-Dist: arrow>=1.4.0
13
+ Requires-Dist: babel>=2.17.0
14
+ Requires-Dist: cowsay>=6.1
15
+ Requires-Dist: dotenv>=0.9.9
16
+ Requires-Dist: etcd3>=0.12.0
17
+ Requires-Dist: fastapi>=0.127.0
18
+ Requires-Dist: ifaddr>=0.2.0
19
+ Requires-Dist: netifaces-plus>=0.12.5
20
+ Requires-Dist: numpy<2.0.0
21
+ Requires-Dist: pandas>=2.3.3
22
+ Requires-Dist: protobuf<4
23
+ Requires-Dist: pydantic-settings>=2.14.2
24
+ Requires-Dist: pymysql>=1.1.2
25
+ Requires-Dist: pytz>=2025.2
26
+ Requires-Dist: pyyaml>=6.0.3
27
+ Requires-Dist: redis[hiredis]>=7.1.0
28
+ Requires-Dist: requests[socks]>=2.32.5
29
+ Requires-Dist: selenium>=4.40.0
30
+ Requires-Dist: slpp>=1.2.3
31
+ Requires-Dist: sqlalchemy>=2.0.45
32
+ Requires-Dist: tabulate>=0.9.0
33
+ Requires-Dist: telethon>=1.44.0
34
+ Requires-Dist: toml>=0.10.2
35
+ Requires-Dist: typer>=0.20.1
36
+ Requires-Dist: uvicorn>=0.40.0
37
+ Requires-Dist: wcwidth==0.8.5
38
+ Requires-Dist: webdriver-manager>=4.0.2
39
+ Description-Content-Type: text/markdown
40
+
41
+ # pymecli
42
+
43
+ 个人 CLI 工具集,基于 [Typer](https://typer.tiangolo.com/) 构建,包含 FastAPI 服务、Redis/MySQL/Etcd 数据同步、DDNS、加密货币行情等模块。
44
+
45
+ ## 快速开始
46
+
47
+ ```shell
48
+ # pipx install pymecli # 使用pipx安装
49
+ uv tool install pymecli # 使用uv安装
50
+ uv tool list
51
+ uv run util --help # 查看所有工具命令
52
+ ```
53
+
54
+ ## 开发
55
+ ```shell
56
+ uv sync # 安装依赖
57
+ uv run util --help # 查看所有工具命令
58
+ uv build # 打包
59
+ uv publish --token <TOKEN> # 发布到 PyPI
60
+ ```
61
+
62
+ ## 模块一览
63
+
64
+ | 命令 | 文件 | 说明 |
65
+ |---|---|---|
66
+ | `util` | `cli/util.py` | 通用工具(ID 生成、时间、emoji、IPv6 等) |
67
+ | `example` | `cli/example.py` | Typer 示例 |
68
+ | `fast` | `cli/fast.py` | FastAPI 服务(clash 订阅转换、Redis API) |
69
+ | `dst` | `cli/dst.py` | 饥荒专服模组管理 |
70
+ | `etcdsync` | `cli/etcd_sync.py` | MySQL ↔ Etcd 数据同步 |
71
+ | `quark` | `cli/quark.py` | 夸克网盘自动签到 |
72
+ | `dnspod` | `cli/dnspod.py` | DNSPod DDNS 自动更新 |
73
+ | `bitget` | `cli/bitget.py` | Bitget 行情 + grid 同步 |
74
+ | `gate` | `cli/gate.py` | Gate grid 数据同步 |
75
+ | `okx` | `cli/okx.py` | OKX grid 数据同步 |
76
+ | `rd` | `cli/redis_csv.py` | Redis ↔ CSV 数据处理 |
77
+ | `tele` | `cli/tele.py` | Telegram 工具 |
78
+
79
+ ---
80
+
81
+ ## util — 通用工具
82
+
83
+ ```shell
84
+ # 生成 secure_id(默认 30 位,字母开头,剔除 i I l L o O 0 1)
85
+ uv run util sid # 默认 30 位
86
+ uv run util sid 16 # 指定长度 16
87
+
88
+ # 生成 UUID / 打印系统信息
89
+ uv run util uuid # 输出 uuid4()
90
+ uv run util os # Windows / Darwin / Linux
91
+
92
+ # 时间戳(秒 / 毫秒)
93
+ uv run util ts # 当前秒级时间戳
94
+ uv run util ms # 当前毫秒级时间戳
95
+
96
+ # Python 版本 / 时区时间 / emoji
97
+ uv run util v # 打印 Python 版本
98
+ uv run util st # 同时打印 UTC / 美东 / 上海时间
99
+ uv run util emoji # 表格形式打印常用 emoji
100
+
101
+ # Uniswap token 排序
102
+ uv run util stoken 0xC02aaA... 0xA0b869... # 返回 token0 token1(按数值排序)
103
+
104
+ # 获取本地 IPv6 稳定地址
105
+ uv run util ipv6 # 打印并写入 Redis key: local.IPv6
106
+ ```
107
+
108
+ ## example — Typer 示例
109
+
110
+ ```shell
111
+ uv run example hello Xiaoming
112
+ uv run example hello Xiaoming --from Pymecli
113
+ uv run example goodbye Xiaoming
114
+ uv run example goodbye Xiaoming -f
115
+ ```
116
+
117
+ ## fast — FastAPI 服务
118
+
119
+ ```shell
120
+ uv run fast --port 8877 # 启动本地服务
121
+ ```
122
+
123
+ ## dst — 饥荒专服模组
124
+
125
+ ```shell
126
+ # 更新 modoverrides.lua 中指定模组的版本信息
127
+ uv run dst convert-update d:/.backups/dontstarvetogether/modoverrides.lua \
128
+ -o c:/.dst/save/Cluster_1/Master/modoverrides.lua \
129
+ -o c:/.dst/save/Cluster_1/Caves/modoverrides.lua
130
+
131
+ # 列出所有 mod,生成 dedicated_server_mods_setup.lua
132
+ uv run dst mod-setup d:/.backups/dontstarvetogether/modoverrides.lua \
133
+ -m 3486375086
134
+ ```
135
+
136
+ ## etcdsync — MySQL ↔ Etcd 同步
137
+
138
+ ```shell
139
+ # MySQL → Etcd
140
+ uv run etcdsync mysql2etcd /test -e d:/.env/pymecli.env -t kvs
141
+ uv run etcdsync mysql2etcd "" -e d:/.env/pymecli.env -t kvs # 全量
142
+
143
+ # Etcd → MySQL
144
+ uv run etcdsync etcd2mysql /test -e d:/.env/pymecli.env -t kvs
145
+ uv run etcdsync etcd2mysql "" -e d:/.env/pymecli.env -t kvs # 全量
146
+
147
+ # Etcd → JSON / JSON → Etcd
148
+ uv run etcdsync etcd2json /test -e d:/.env/pymecli.env -f xxx.json
149
+ uv run etcdsync json2etcd /test -e d:/.env/pymecli.env -f xxx.json
150
+ ```
151
+
152
+ ## quark — 夸克网盘签到
153
+
154
+ ```shell
155
+ uv run quark sign # 签到(默认发通知)
156
+ uv run quark sign --no-notify # 签到但不发通知
157
+ uv run quark sign -e /path/to/.env # 指定 dotenv 路径
158
+ uv run quark check # 检查账号配置和成长信息
159
+ ```
160
+
161
+ ## dnspod — DDNS
162
+
163
+ ### 环境变量
164
+
165
+ - `DP_ID`: DNSPod 登录 ID
166
+ - `DP_TOKEN`: DNSPod 登录 Token
167
+ - `DP_DOMAIN`: 域名(如 cursor.email)
168
+ - `DP_RECORD_ID`: IPv4 A 记录 ID
169
+ - `DP_RECORD_ID_IPV6`: IPv6 AAAA 记录 ID
170
+ - `DP_SUB_DOMAIN`: 子域名前缀(默认 "api")
171
+ - `DP_RECORD_LINE`: 记录线路(默认 "默认")
172
+
173
+ ### 示例
174
+
175
+ ```shell
176
+ uv run dnspod list # 列出域名下所有记录(先跑这个查 record_id)
177
+ uv run dnspod ddns # 更新 IPv4 A 记录
178
+ uv run dnspod ddns --force # 强制更新(即使 IP 没变化)
179
+ uv run dnspod ddns6 # 更新 IPv6 AAAA 记录(从 Redis 读 local.IPv6)
180
+ uv run dnspod ddns6 --force
181
+ ```
182
+
183
+ ## bitget — Bitget 行情
184
+
185
+ ```shell
186
+ # 同步 MySQL grid 数据到 Redis
187
+ uv run bitget sync d:/.env/pymecli.env
188
+
189
+ # 获取现货 / 合约价格(支持代理)
190
+ uv run bitget spot BTCUSDT,ETHUSDT
191
+ uv run bitget spot BTCUSDT -p http://127.0.0.1:7897
192
+ uv run bitget mix BTCUSDT_UMCBL,SOLUSDT_UMCBL -p http://127.0.0.1:7897
193
+ ```
194
+
195
+ ## gate / okx — Grid 数据同步
196
+
197
+ ```shell
198
+ uv run gate d:/.env/pymecli.env # Gate → Redis
199
+ uv run okx d:/.env/pymecli.env # OKX → Redis
200
+ ```
201
+
202
+ ## rd — Redis ↔ CSV
203
+
204
+ ```shell
205
+ # 查询 Redis ZSet 记录数
206
+ uv run rd count my_prefix
207
+
208
+ # CSV → Redis(按 id1、id2 组合 key)
209
+ uv run rd csv2redis symbol timeframe -fp data/file.csv -kp my_prefix
210
+
211
+ # CSV → CSV(时间字符串转时间戳、删列)
212
+ uv run rd convert data/file.csv
213
+ ```
214
+
215
+ ## tele — Telegram 工具
216
+
217
+ > 需先在 `pyproject.toml` 的 `[project.scripts]` 取消注释 `tele = "cli.tele:app"`。
218
+
219
+ ```shell
220
+ uv run tele info .env # 查看 TELE_SESSION_STRING
221
+ uv run tele check .env # 验证 session 是否有效
222
+ uv run tele login .env # 登录生成新 session
223
+ uv run tele upload image.jpg # 上传图片到 Telegram
224
+ uv run tele list-channels .env # 列出已加入的频道
225
+ ```
@@ -0,0 +1,185 @@
1
+ # pymecli
2
+
3
+ 个人 CLI 工具集,基于 [Typer](https://typer.tiangolo.com/) 构建,包含 FastAPI 服务、Redis/MySQL/Etcd 数据同步、DDNS、加密货币行情等模块。
4
+
5
+ ## 快速开始
6
+
7
+ ```shell
8
+ # pipx install pymecli # 使用pipx安装
9
+ uv tool install pymecli # 使用uv安装
10
+ uv tool list
11
+ uv run util --help # 查看所有工具命令
12
+ ```
13
+
14
+ ## 开发
15
+ ```shell
16
+ uv sync # 安装依赖
17
+ uv run util --help # 查看所有工具命令
18
+ uv build # 打包
19
+ uv publish --token <TOKEN> # 发布到 PyPI
20
+ ```
21
+
22
+ ## 模块一览
23
+
24
+ | 命令 | 文件 | 说明 |
25
+ |---|---|---|
26
+ | `util` | `cli/util.py` | 通用工具(ID 生成、时间、emoji、IPv6 等) |
27
+ | `example` | `cli/example.py` | Typer 示例 |
28
+ | `fast` | `cli/fast.py` | FastAPI 服务(clash 订阅转换、Redis API) |
29
+ | `dst` | `cli/dst.py` | 饥荒专服模组管理 |
30
+ | `etcdsync` | `cli/etcd_sync.py` | MySQL ↔ Etcd 数据同步 |
31
+ | `quark` | `cli/quark.py` | 夸克网盘自动签到 |
32
+ | `dnspod` | `cli/dnspod.py` | DNSPod DDNS 自动更新 |
33
+ | `bitget` | `cli/bitget.py` | Bitget 行情 + grid 同步 |
34
+ | `gate` | `cli/gate.py` | Gate grid 数据同步 |
35
+ | `okx` | `cli/okx.py` | OKX grid 数据同步 |
36
+ | `rd` | `cli/redis_csv.py` | Redis ↔ CSV 数据处理 |
37
+ | `tele` | `cli/tele.py` | Telegram 工具 |
38
+
39
+ ---
40
+
41
+ ## util — 通用工具
42
+
43
+ ```shell
44
+ # 生成 secure_id(默认 30 位,字母开头,剔除 i I l L o O 0 1)
45
+ uv run util sid # 默认 30 位
46
+ uv run util sid 16 # 指定长度 16
47
+
48
+ # 生成 UUID / 打印系统信息
49
+ uv run util uuid # 输出 uuid4()
50
+ uv run util os # Windows / Darwin / Linux
51
+
52
+ # 时间戳(秒 / 毫秒)
53
+ uv run util ts # 当前秒级时间戳
54
+ uv run util ms # 当前毫秒级时间戳
55
+
56
+ # Python 版本 / 时区时间 / emoji
57
+ uv run util v # 打印 Python 版本
58
+ uv run util st # 同时打印 UTC / 美东 / 上海时间
59
+ uv run util emoji # 表格形式打印常用 emoji
60
+
61
+ # Uniswap token 排序
62
+ uv run util stoken 0xC02aaA... 0xA0b869... # 返回 token0 token1(按数值排序)
63
+
64
+ # 获取本地 IPv6 稳定地址
65
+ uv run util ipv6 # 打印并写入 Redis key: local.IPv6
66
+ ```
67
+
68
+ ## example — Typer 示例
69
+
70
+ ```shell
71
+ uv run example hello Xiaoming
72
+ uv run example hello Xiaoming --from Pymecli
73
+ uv run example goodbye Xiaoming
74
+ uv run example goodbye Xiaoming -f
75
+ ```
76
+
77
+ ## fast — FastAPI 服务
78
+
79
+ ```shell
80
+ uv run fast --port 8877 # 启动本地服务
81
+ ```
82
+
83
+ ## dst — 饥荒专服模组
84
+
85
+ ```shell
86
+ # 更新 modoverrides.lua 中指定模组的版本信息
87
+ uv run dst convert-update d:/.backups/dontstarvetogether/modoverrides.lua \
88
+ -o c:/.dst/save/Cluster_1/Master/modoverrides.lua \
89
+ -o c:/.dst/save/Cluster_1/Caves/modoverrides.lua
90
+
91
+ # 列出所有 mod,生成 dedicated_server_mods_setup.lua
92
+ uv run dst mod-setup d:/.backups/dontstarvetogether/modoverrides.lua \
93
+ -m 3486375086
94
+ ```
95
+
96
+ ## etcdsync — MySQL ↔ Etcd 同步
97
+
98
+ ```shell
99
+ # MySQL → Etcd
100
+ uv run etcdsync mysql2etcd /test -e d:/.env/pymecli.env -t kvs
101
+ uv run etcdsync mysql2etcd "" -e d:/.env/pymecli.env -t kvs # 全量
102
+
103
+ # Etcd → MySQL
104
+ uv run etcdsync etcd2mysql /test -e d:/.env/pymecli.env -t kvs
105
+ uv run etcdsync etcd2mysql "" -e d:/.env/pymecli.env -t kvs # 全量
106
+
107
+ # Etcd → JSON / JSON → Etcd
108
+ uv run etcdsync etcd2json /test -e d:/.env/pymecli.env -f xxx.json
109
+ uv run etcdsync json2etcd /test -e d:/.env/pymecli.env -f xxx.json
110
+ ```
111
+
112
+ ## quark — 夸克网盘签到
113
+
114
+ ```shell
115
+ uv run quark sign # 签到(默认发通知)
116
+ uv run quark sign --no-notify # 签到但不发通知
117
+ uv run quark sign -e /path/to/.env # 指定 dotenv 路径
118
+ uv run quark check # 检查账号配置和成长信息
119
+ ```
120
+
121
+ ## dnspod — DDNS
122
+
123
+ ### 环境变量
124
+
125
+ - `DP_ID`: DNSPod 登录 ID
126
+ - `DP_TOKEN`: DNSPod 登录 Token
127
+ - `DP_DOMAIN`: 域名(如 cursor.email)
128
+ - `DP_RECORD_ID`: IPv4 A 记录 ID
129
+ - `DP_RECORD_ID_IPV6`: IPv6 AAAA 记录 ID
130
+ - `DP_SUB_DOMAIN`: 子域名前缀(默认 "api")
131
+ - `DP_RECORD_LINE`: 记录线路(默认 "默认")
132
+
133
+ ### 示例
134
+
135
+ ```shell
136
+ uv run dnspod list # 列出域名下所有记录(先跑这个查 record_id)
137
+ uv run dnspod ddns # 更新 IPv4 A 记录
138
+ uv run dnspod ddns --force # 强制更新(即使 IP 没变化)
139
+ uv run dnspod ddns6 # 更新 IPv6 AAAA 记录(从 Redis 读 local.IPv6)
140
+ uv run dnspod ddns6 --force
141
+ ```
142
+
143
+ ## bitget — Bitget 行情
144
+
145
+ ```shell
146
+ # 同步 MySQL grid 数据到 Redis
147
+ uv run bitget sync d:/.env/pymecli.env
148
+
149
+ # 获取现货 / 合约价格(支持代理)
150
+ uv run bitget spot BTCUSDT,ETHUSDT
151
+ uv run bitget spot BTCUSDT -p http://127.0.0.1:7897
152
+ uv run bitget mix BTCUSDT_UMCBL,SOLUSDT_UMCBL -p http://127.0.0.1:7897
153
+ ```
154
+
155
+ ## gate / okx — Grid 数据同步
156
+
157
+ ```shell
158
+ uv run gate d:/.env/pymecli.env # Gate → Redis
159
+ uv run okx d:/.env/pymecli.env # OKX → Redis
160
+ ```
161
+
162
+ ## rd — Redis ↔ CSV
163
+
164
+ ```shell
165
+ # 查询 Redis ZSet 记录数
166
+ uv run rd count my_prefix
167
+
168
+ # CSV → Redis(按 id1、id2 组合 key)
169
+ uv run rd csv2redis symbol timeframe -fp data/file.csv -kp my_prefix
170
+
171
+ # CSV → CSV(时间字符串转时间戳、删列)
172
+ uv run rd convert data/file.csv
173
+ ```
174
+
175
+ ## tele — Telegram 工具
176
+
177
+ > 需先在 `pyproject.toml` 的 `[project.scripts]` 取消注释 `tele = "cli.tele:app"`。
178
+
179
+ ```shell
180
+ uv run tele info .env # 查看 TELE_SESSION_STRING
181
+ uv run tele check .env # 验证 session 是否有效
182
+ uv run tele login .env # 登录生成新 session
183
+ uv run tele upload image.jpg # 上传图片到 Telegram
184
+ uv run tele list-channels .env # 列出已加入的频道
185
+ ```
@@ -13,7 +13,7 @@ import typer
13
13
  from babel.dates import format_datetime
14
14
  from cowsay.__main__ import cli
15
15
  from tabulate import tabulate
16
- from wcwidth import wcswidth
16
+ from wcwidth import ljust, wcswidth
17
17
 
18
18
  from utils.pyredis import get_redis_client_sync
19
19
 
@@ -24,15 +24,17 @@ app = typer.Typer()
24
24
  def sid(
25
25
  length: int = typer.Argument(30, help="生成secure_id的长度"),
26
26
  ):
27
+ # 剔除易混淆字符: i I l L o O 0 1
27
28
  chars = (
28
29
  (string.ascii_letters + string.digits)
29
- .replace("i", "")
30
- .replace("I", "")
31
- .replace("o", "")
32
- .replace("O", "")
30
+ .replace("i", "").replace("I", "")
31
+ .replace("l", "").replace("L", "")
32
+ .replace("o", "").replace("O", "")
33
+ .replace("0", "").replace("1", "")
33
34
  )
34
- id = "".join(secrets.choice(chars) for _ in range(length))
35
- print(id)
35
+ first = secrets.choice(string.ascii_letters) # 字母开头
36
+ rest = "".join(secrets.choice(chars) for _ in range(max(0, length - 1)))
37
+ print(first + rest)
36
38
 
37
39
 
38
40
  @app.command()
@@ -74,22 +76,19 @@ def emoji():
74
76
  " ⬇️ ⬆️ ↕️ 🍅 🍥 ☃️ 🐳 🤖 🪃 💰 🦣 🦄 🐼 ♂️ ♀️ 🐝"
75
77
  ).split()
76
78
 
77
- # 把每个 emoji 补到 len=2 且 wcswidth=2,保证 tabulate 算列宽和终端显示一致
78
- # FE0F 是 emoji 变体检视符:加了之后 SMP emoji len 从 1 变 2,wcswidth 仍是 2
79
- VS = "\ufe0f"
79
+ # tabulate 用 len() 算列宽,终端用 wcswidth() 算显示宽度,
80
+ # 需要把每个字符补到 len=2 且 wcswidth=2 才能对齐
81
+ # - 宽字符 (len=1, wcsw=2): 加 ZWSP(U+200B 零宽空格) 补 len,不改显示
82
+ # - 窄符号 (wcsw=1): 用 wcwidth.ljust 补空格到 wcsw=2
83
+ ZWSP = "\u200b"
80
84
 
81
85
  def pad(e: str) -> str:
82
- w = wcswidth(e)
83
- l = len(e)
84
- # SMP emoji: len=1, wcsw=2 → 加 VS 变 len=2, wcsw=2
85
- if l == 1 and w == 2:
86
- e = e + VS
87
- # 窄符号: wcsw=1 → 加空格补显示宽度
88
- space = " " * max(0, 2 - wcswidth(e))
89
- return e + space
86
+ if len(e) == 1 and wcswidth(e) == 2:
87
+ e += ZWSP
88
+ return ljust(e, 2)
89
+
90
90
  padded = [pad(e) for e in emoji_list]
91
91
 
92
- # 重排成 10 列的二维表,最后一行空位填空字符串
93
92
  rows = []
94
93
  for i in range(0, len(padded), 10):
95
94
  row = padded[i : i + 10]
@@ -268,25 +268,25 @@ class ClashYamlGenerator:
268
268
 
269
269
  def _add_base_rules(self, template, with_dst_port=False):
270
270
  """IP-CIDR / DOMAIN 基础规则(genPB / genB),genB 含饥荒端口"""
271
- template["rules"].extend(
272
- [
273
- "IP-CIDR,192.168.0.0/16,DIRECT,no-resolve",
274
- "IP-CIDR,10.0.0.0/8,DIRECT,no-resolve",
275
- "IP-CIDR,172.16.0.0/12,DIRECT,no-resolve",
276
- "IP-CIDR,127.0.0.0/8,DIRECT,no-resolve",
277
- ]
278
- )
279
- if with_dst_port:
280
- template["rules"].extend(
281
- [
282
- "DST-PORT,10999,DIRECT",
283
- "DST-PORT,10998,DIRECT",
284
- "DST-PORT,27016,DIRECT",
285
- "DST-PORT,27017,DIRECT",
286
- "DST-PORT,8766,DIRECT",
287
- "DST-PORT,8767,DIRECT",
288
- ]
289
- )
271
+ # template["rules"].extend(
272
+ # [
273
+ # "IP-CIDR,192.168.0.0/16,DIRECT,no-resolve",
274
+ # "IP-CIDR,10.0.0.0/8,DIRECT,no-resolve",
275
+ # "IP-CIDR,172.16.0.0/12,DIRECT,no-resolve",
276
+ # "IP-CIDR,127.0.0.0/8,DIRECT,no-resolve",
277
+ # ]
278
+ # )
279
+ # if with_dst_port:
280
+ # template["rules"].extend(
281
+ # [
282
+ # "DST-PORT,10999,DIRECT",
283
+ # "DST-PORT,10998,DIRECT",
284
+ # "DST-PORT,27016,DIRECT",
285
+ # "DST-PORT,27017,DIRECT",
286
+ # "DST-PORT,8766,DIRECT",
287
+ # "DST-PORT,8767,DIRECT",
288
+ # ]
289
+ # )
290
290
  template["rules"].extend(
291
291
  [
292
292
  "DOMAIN,clash.razord.top,DIRECT",
@@ -32,13 +32,14 @@
32
32
  "ifaddr>=0.2.0",
33
33
  "telethon>=1.44.0",
34
34
  "protobuf<4",
35
+ "wcwidth==0.8.5",
35
36
  ]
36
37
  description = "My CLI"
37
38
  license = { text = "MIT" }
38
39
  name = "pymecli"
39
40
  readme = "README.md"
40
41
  requires-python = ">=3.10"
41
- version = "0.6.5"
42
+ version = "0.6.7"
42
43
 
43
44
  [project.urls]
44
45
  Homepage = "https://pypi.org/project/pymecli"
@@ -58,7 +59,7 @@
58
59
  util = "cli.util:app"
59
60
  # 临时命令
60
61
  rd = "cli.redis_csv:app"
61
- # tele = "cli.tele:app"
62
+ tele = "cli.tele:app"
62
63
 
63
64
  [tool.uv]
64
65
  [[tool.uv.index]]
pymecli-0.6.5/PKG-INFO DELETED
@@ -1,110 +0,0 @@
1
- Metadata-Version: 2.5
2
- Name: pymecli
3
- Version: 0.6.5
4
- Summary: My CLI
5
- Project-URL: Homepage, https://pypi.org/project/pymecli
6
- Project-URL: Repository, https://github.com/meme2046/pymecli
7
- License: MIT
8
- Classifier: Intended Audience :: Developers
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Programming Language :: Python :: 3
11
- Requires-Python: >=3.10
12
- Requires-Dist: arrow>=1.4.0
13
- Requires-Dist: babel>=2.17.0
14
- Requires-Dist: cowsay>=6.1
15
- Requires-Dist: dotenv>=0.9.9
16
- Requires-Dist: etcd3>=0.12.0
17
- Requires-Dist: fastapi>=0.127.0
18
- Requires-Dist: ifaddr>=0.2.0
19
- Requires-Dist: netifaces-plus>=0.12.5
20
- Requires-Dist: numpy<2.0.0
21
- Requires-Dist: pandas>=2.3.3
22
- Requires-Dist: protobuf<4
23
- Requires-Dist: pydantic-settings>=2.14.2
24
- Requires-Dist: pymysql>=1.1.2
25
- Requires-Dist: pytz>=2025.2
26
- Requires-Dist: pyyaml>=6.0.3
27
- Requires-Dist: redis[hiredis]>=7.1.0
28
- Requires-Dist: requests[socks]>=2.32.5
29
- Requires-Dist: selenium>=4.40.0
30
- Requires-Dist: slpp>=1.2.3
31
- Requires-Dist: sqlalchemy>=2.0.45
32
- Requires-Dist: tabulate>=0.9.0
33
- Requires-Dist: telethon>=1.44.0
34
- Requires-Dist: toml>=0.10.2
35
- Requires-Dist: typer>=0.20.1
36
- Requires-Dist: uvicorn>=0.40.0
37
- Requires-Dist: webdriver-manager>=4.0.2
38
- Description-Content-Type: text/markdown
39
-
40
- # typer example
41
-
42
- ```shell
43
- uv run example hello Xiaoming
44
- uv run example hello Xiaoming --from Pymecli
45
- uv run example goodbye Xiaoming
46
- uv run example goodbye Xiaoming -f
47
- ```
48
-
49
- # fastapi server
50
-
51
- ```shell
52
- uv run fast --port 8877 # local server
53
- uv build
54
- uv publish --token < TOKEN > # publish
55
- ```
56
-
57
- # dontstarvetogether
58
-
59
- 1. 饥荒专服禁client mods使用, 更新client mods version, modoverrides.lua:
60
-
61
- ```shell
62
- uv run dst cmu d:/.backups/dontstarvetogether/modoverrides.lua -o c:/.dst/save/Cluster_1/Master/modoverrides.lua -o c:/.dst/save/Cluster_1/Caves/modoverrides.lua
63
-
64
- uv run dst cml d:/.backups/dontstarvetogether/modoverrides.lua -m 3486375086
65
- ```
66
-
67
- # etcdsync
68
-
69
- ```shell
70
- etcdsync etcd2mysql /test -e d:/.env/pymecli.env -t kvs
71
- etcdsync etcd2mysql "" -e d:/.env/pymecli.env -t kvs # 全量
72
- etcdsync mysql2etcd /test -e d:/.env/pymecli.env -t kvs
73
- etcdsync mysql2etcd -e d:/.env/pymecli.env -t kvs # 全量
74
-
75
- etcdsync etcd2json /test -e d:/.env/pymecli.env -f xxx.json
76
- etcdsync json2etcd /test -e d:/.env/pymecli.env -f xxx.json
77
- ```
78
- # quark
79
- ```shell
80
- # 执行签到(默认会发通知)
81
- uv run quark sign
82
- # 签到但不发通知
83
- uv run quark sign --no-notify
84
- # 指定不同的 dotenv 路径
85
- uv run quark sign -e /path/to/.env
86
- # 只检查账号状态(不签到),方便调试
87
- uv run quark check
88
- ```
89
-
90
- # dnspod
91
- ## 环境变量说明
92
- - `DP_ID`: DNSPod 登录 ID
93
- - `DP_TOKEN`: DNSPod 登录 Token
94
- - `DP_DOMAIN`: 域名 (如 cursor.email)
95
- - `DP_RECORD_ID`: IPv4 A 记录 ID
96
- - `DP_RECORD_ID_IPV6`: IPv6 AAAA 记录 ID
97
- - `DP_SUB_DOMAIN`: 子域名前缀 (默认 "api")
98
- - `DP_RECORD_LINE`: 记录线路 (默认 "默认")
99
- ## 示例
100
- ```shell
101
- # 列出域名下所有记录(先跑这个查 record_id)
102
- uv run dnspod list
103
- # 更新 IPv4 A 记录
104
- uv run dnspod ddns
105
- # 强制更新(即使 IP 没变化)
106
- uv run dnspod ddns --force
107
- # 更新 IPv6 AAAA 记录(从 Redis 读 local.IPv6)
108
- uv run dnspod ddns6
109
- uv run dnspod ddns6 --force
110
- ```
pymecli-0.6.5/README.md DELETED
@@ -1,71 +0,0 @@
1
- # typer example
2
-
3
- ```shell
4
- uv run example hello Xiaoming
5
- uv run example hello Xiaoming --from Pymecli
6
- uv run example goodbye Xiaoming
7
- uv run example goodbye Xiaoming -f
8
- ```
9
-
10
- # fastapi server
11
-
12
- ```shell
13
- uv run fast --port 8877 # local server
14
- uv build
15
- uv publish --token < TOKEN > # publish
16
- ```
17
-
18
- # dontstarvetogether
19
-
20
- 1. 饥荒专服禁client mods使用, 更新client mods version, modoverrides.lua:
21
-
22
- ```shell
23
- uv run dst cmu d:/.backups/dontstarvetogether/modoverrides.lua -o c:/.dst/save/Cluster_1/Master/modoverrides.lua -o c:/.dst/save/Cluster_1/Caves/modoverrides.lua
24
-
25
- uv run dst cml d:/.backups/dontstarvetogether/modoverrides.lua -m 3486375086
26
- ```
27
-
28
- # etcdsync
29
-
30
- ```shell
31
- etcdsync etcd2mysql /test -e d:/.env/pymecli.env -t kvs
32
- etcdsync etcd2mysql "" -e d:/.env/pymecli.env -t kvs # 全量
33
- etcdsync mysql2etcd /test -e d:/.env/pymecli.env -t kvs
34
- etcdsync mysql2etcd -e d:/.env/pymecli.env -t kvs # 全量
35
-
36
- etcdsync etcd2json /test -e d:/.env/pymecli.env -f xxx.json
37
- etcdsync json2etcd /test -e d:/.env/pymecli.env -f xxx.json
38
- ```
39
- # quark
40
- ```shell
41
- # 执行签到(默认会发通知)
42
- uv run quark sign
43
- # 签到但不发通知
44
- uv run quark sign --no-notify
45
- # 指定不同的 dotenv 路径
46
- uv run quark sign -e /path/to/.env
47
- # 只检查账号状态(不签到),方便调试
48
- uv run quark check
49
- ```
50
-
51
- # dnspod
52
- ## 环境变量说明
53
- - `DP_ID`: DNSPod 登录 ID
54
- - `DP_TOKEN`: DNSPod 登录 Token
55
- - `DP_DOMAIN`: 域名 (如 cursor.email)
56
- - `DP_RECORD_ID`: IPv4 A 记录 ID
57
- - `DP_RECORD_ID_IPV6`: IPv6 AAAA 记录 ID
58
- - `DP_SUB_DOMAIN`: 子域名前缀 (默认 "api")
59
- - `DP_RECORD_LINE`: 记录线路 (默认 "默认")
60
- ## 示例
61
- ```shell
62
- # 列出域名下所有记录(先跑这个查 record_id)
63
- uv run dnspod list
64
- # 更新 IPv4 A 记录
65
- uv run dnspod ddns
66
- # 强制更新(即使 IP 没变化)
67
- uv run dnspod ddns --force
68
- # 更新 IPv6 AAAA 记录(从 Redis 读 local.IPv6)
69
- uv run dnspod ddns6
70
- uv run dnspod ddns6 --force
71
- ```
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes