kitecmd 0.5__tar.gz → 0.6__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.
@@ -1,9 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kitecmd
3
- Version: 0.5
4
- Summary: A simple CLI example for PyPI that runs anywhere
3
+ Version: 0.6
4
+ Summary: A CLI tool with update checking
5
5
  Author: coltonsr77
6
6
  Requires-Python: >=3.8
7
+ Requires-Dist: requests
7
8
  Dynamic: author
9
+ Dynamic: requires-dist
8
10
  Dynamic: requires-python
9
11
  Dynamic: summary
@@ -0,0 +1 @@
1
+ __version__ = "0.6"
@@ -0,0 +1,79 @@
1
+ import argparse
2
+ import requests
3
+ import sys
4
+ from importlib.metadata import version, PackageNotFoundError
5
+
6
+
7
+ def main():
8
+ parser = argparse.ArgumentParser(
9
+ prog="kitecmd",
10
+ description="Kite Command Utility"
11
+ )
12
+
13
+ # Global version flag
14
+ parser.add_argument(
15
+ "--version", "-v",
16
+ action="store_true",
17
+ help="Show the current version of kitecmd"
18
+ )
19
+
20
+ subparsers = parser.add_subparsers(dest="command", help="Available commands")
21
+
22
+ # === test command ===
23
+ test_parser = subparsers.add_parser("test", help="Run a test message")
24
+ test_parser.add_argument("--msg", "-m", default="This is a test.", help="Custom test message")
25
+
26
+ # === checkupdate command ===
27
+ subparsers.add_parser("checkupdate", help="Check if a new version is available on PyPI")
28
+
29
+ # === version command ===
30
+ subparsers.add_parser("version", help="Show the current version of kitecmd")
31
+
32
+ args = parser.parse_args()
33
+
34
+ # --- Command logic ---
35
+ if args.version or args.command == "version":
36
+ show_version("kitecmd")
37
+
38
+ elif args.command == "test":
39
+ print(f"🧪 {args.msg}")
40
+
41
+ elif args.command == "checkupdate":
42
+ check_for_update("kitecmd")
43
+
44
+ else:
45
+ parser.print_help()
46
+
47
+
48
+ def show_version(package_name):
49
+ """Print the installed version."""
50
+ try:
51
+ current_version = version(package_name)
52
+ print(f"kitecmd version {current_version}")
53
+ except PackageNotFoundError:
54
+ print("⚠️ Could not determine the version (package not found).")
55
+
56
+
57
+ def check_for_update(package_name):
58
+ """Check PyPI for the latest version of this package."""
59
+ try:
60
+ current_version = version(package_name)
61
+ except PackageNotFoundError:
62
+ print("⚠️ Unable to detect installed version.")
63
+ sys.exit(1)
64
+
65
+ try:
66
+ resp = requests.get(f"https://pypi.org/pypi/{package_name}/json", timeout=5)
67
+ resp.raise_for_status()
68
+ latest_version = resp.json()["info"]["version"]
69
+ except requests.RequestException as e:
70
+ print(f"❌ Could not fetch update info: {e}")
71
+ sys.exit(1)
72
+
73
+ if current_version == latest_version:
74
+ print(f"✅ You are using the latest version ({current_version})")
75
+ else:
76
+ print(f"⬆️ A new version is available!")
77
+ print(f" Installed: {current_version}")
78
+ print(f" Latest: {latest_version}")
79
+ print(f"👉 To update, run: pip install --upgrade {package_name}")
@@ -1,9 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kitecmd
3
- Version: 0.5
4
- Summary: A simple CLI example for PyPI that runs anywhere
3
+ Version: 0.6
4
+ Summary: A CLI tool with update checking
5
5
  Author: coltonsr77
6
6
  Requires-Python: >=3.8
7
+ Requires-Dist: requests
7
8
  Dynamic: author
9
+ Dynamic: requires-dist
8
10
  Dynamic: requires-python
9
11
  Dynamic: summary
@@ -8,4 +8,5 @@ kitecmd.egg-info/PKG-INFO
8
8
  kitecmd.egg-info/SOURCES.txt
9
9
  kitecmd.egg-info/dependency_links.txt
10
10
  kitecmd.egg-info/entry_points.txt
11
+ kitecmd.egg-info/requires.txt
11
12
  kitecmd.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ requests
@@ -2,10 +2,11 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="kitecmd",
5
- version="0.5",
5
+ version="0.6",
6
6
  author="coltonsr77",
7
- description="A simple CLI example for PyPI that runs anywhere",
7
+ description="A CLI tool with update checking",
8
8
  packages=find_packages(include=["kitecmd", "kitecmd.*"]),
9
+ install_requires=["requests"],
9
10
  entry_points={
10
11
  "console_scripts": [
11
12
  "kitecmd=kitecmd.cli:main",
@@ -1 +0,0 @@
1
- __version__ = "0.5"
@@ -1,26 +0,0 @@
1
- import argparse
2
-
3
- def main():
4
- parser = argparse.ArgumentParser(
5
- prog="kitecmd",
6
- description="Kite Command Utility"
7
- )
8
- subparsers = parser.add_subparsers(dest="command", help="Available commands")
9
-
10
- # Example: hello
11
- hello_parser = subparsers.add_parser("hello", help="Print a greeting")
12
- hello_parser.add_argument("--name", "-n", default="World", help="Who to greet")
13
-
14
- # Example: add
15
- add_parser = subparsers.add_parser("add", help="Add two numbers")
16
- add_parser.add_argument("a", type=float, help="First number")
17
- add_parser.add_argument("b", type=float, help="Second number")
18
-
19
- args = parser.parse_args()
20
-
21
- if args.command == "hello":
22
- print(f"Hello, {args.name}!")
23
- elif args.command == "add":
24
- print(f"Result: {args.a + args.b}")
25
- else:
26
- parser.print_help()
File without changes
File without changes
File without changes
File without changes