jej-when 1.0.0__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.
- jej_when-1.0.0/PKG-INFO +18 -0
- jej_when-1.0.0/README.md +10 -0
- jej_when-1.0.0/jej_when.egg-info/PKG-INFO +18 -0
- jej_when-1.0.0/jej_when.egg-info/SOURCES.txt +9 -0
- jej_when-1.0.0/jej_when.egg-info/dependency_links.txt +1 -0
- jej_when-1.0.0/jej_when.egg-info/entry_points.txt +2 -0
- jej_when-1.0.0/jej_when.egg-info/top_level.txt +1 -0
- jej_when-1.0.0/pyproject.toml +17 -0
- jej_when-1.0.0/setup.cfg +4 -0
- jej_when-1.0.0/when_tool/__init__.py +0 -0
- jej_when-1.0.0/when_tool/main.py +36 -0
jej_when-1.0.0/PKG-INFO
ADDED
|
@@ -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
|
jej_when-1.0.0/README.md
ADDED
|
@@ -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 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
when_tool
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "jej-when"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "A stupidly simple CLI to tell time across timezones."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{ name = "Jej111" }
|
|
12
|
+
]
|
|
13
|
+
requires-python = ">=3.7"
|
|
14
|
+
|
|
15
|
+
[project.scripts]
|
|
16
|
+
# 重点在这里!这行代码把 when 映射到了 main 函数
|
|
17
|
+
when = "when_tool.main:main"
|
jej_when-1.0.0/setup.cfg
ADDED
|
File without changes
|
|
@@ -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()
|