jej-when 1.0.0__py3-none-any.whl

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.
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: jej-when
3
+ Version: 1.0.0
4
+ Summary: A stupidly simple CLI to tell time across timezones.
5
+ Author: Jej111
6
+ Requires-Python: >=3.7
7
+ Description-Content-Type: text/markdown
8
+
9
+ # Jej-WHEN ⏱️
10
+
11
+ Because remembering `Asia/Shanghai` is a pain.
12
+
13
+ A stupidly simple CLI to tell time across timezones.
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ pip install jej-when
@@ -0,0 +1,7 @@
1
+ when_tool/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ when_tool/main.py,sha256=zQYRNfTUW0VvfAlo8jwqZfYLe-iO_v5xoiOq_ov19FQ,1101
3
+ jej_when-1.0.0.dist-info/METADATA,sha256=efgzwzVPaV1DGF2w_WXFv2nSrkOi7wDwGidIxDX_Oog,360
4
+ jej_when-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
5
+ jej_when-1.0.0.dist-info/entry_points.txt,sha256=UYhgp0Utf5RCRHLNdeJ8GvC4KtdNI0TkqPprNVb58oc,45
6
+ jej_when-1.0.0.dist-info/top_level.txt,sha256=ftBAOSF1VKJd22p9--Cs_Lnc8UhaOCKhe9Bcwby9j2c,10
7
+ jej_when-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ when = when_tool.main:main
@@ -0,0 +1 @@
1
+ when_tool
when_tool/__init__.py ADDED
File without changes
when_tool/main.py ADDED
@@ -0,0 +1,36 @@
1
+ import sys
2
+ from datetime import datetime, timezone, timedelta
3
+
4
+ def main():
5
+ # 无参数时,输出本地时间及用法提示(全英文)
6
+ if len(sys.argv) < 2:
7
+ now = datetime.now()
8
+ print(f"🕒 Local Time | {now.strftime('%Y-%m-%d %H:%M:%S')}")
9
+ print("💡 Usage: when <offset> (e.g., when +8, when -5, when 0)")
10
+ print("📖 Help: Get the current time in any UTC offset.")
11
+ return
12
+
13
+ arg = sys.argv[1]
14
+
15
+ try:
16
+ # 兼容用户输入 +8 或 8
17
+ offset = int(arg)
18
+
19
+ # 构造目标时区
20
+ target_tz = timezone(timedelta(hours=offset))
21
+
22
+ # 获取该时区的当前时间
23
+ now = datetime.now(target_tz)
24
+
25
+ # 格式化输出
26
+ sign = "+" if offset >= 0 else ""
27
+ print(f"🌍 UTC{sign}{offset} | {now.strftime('%Y-%m-%d %H:%M:%S')}")
28
+
29
+ except ValueError:
30
+ # 纯英文报错
31
+ print(f"❌ Error: '{arg}' is not a valid UTC offset.")
32
+ print("💡 Example: when +8, when -5, when 0")
33
+ sys.exit(1)
34
+
35
+ if __name__ == "__main__":
36
+ main()