kitecmd 0.5__tar.gz → 0.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.
- {kitecmd-0.5 → kitecmd-0.7}/PKG-INFO +4 -2
- kitecmd-0.7/kitecmd/__init__.py +1 -0
- kitecmd-0.7/kitecmd/cli.py +96 -0
- {kitecmd-0.5 → kitecmd-0.7}/kitecmd.egg-info/PKG-INFO +4 -2
- {kitecmd-0.5 → kitecmd-0.7}/kitecmd.egg-info/SOURCES.txt +1 -0
- kitecmd-0.7/kitecmd.egg-info/requires.txt +1 -0
- {kitecmd-0.5 → kitecmd-0.7}/setup.py +3 -2
- kitecmd-0.5/kitecmd/__init__.py +0 -1
- kitecmd-0.5/kitecmd/cli.py +0 -26
- {kitecmd-0.5 → kitecmd-0.7}/README.md +0 -0
- {kitecmd-0.5 → kitecmd-0.7}/kitecmd/__main__.py +0 -0
- {kitecmd-0.5 → kitecmd-0.7}/kitecmd.egg-info/dependency_links.txt +0 -0
- {kitecmd-0.5 → kitecmd-0.7}/kitecmd.egg-info/entry_points.txt +0 -0
- {kitecmd-0.5 → kitecmd-0.7}/kitecmd.egg-info/top_level.txt +0 -0
- {kitecmd-0.5 → kitecmd-0.7}/pyproject.toml +0 -0
- {kitecmd-0.5 → kitecmd-0.7}/setup.cfg +0 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kitecmd
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: A
|
|
3
|
+
Version: 0.7
|
|
4
|
+
Summary: A CLI tool with update checking and other tools.
|
|
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.7"
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import requests
|
|
3
|
+
import sys
|
|
4
|
+
import platform
|
|
5
|
+
import os
|
|
6
|
+
from importlib.metadata import version, PackageNotFoundError
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def main():
|
|
10
|
+
parser = argparse.ArgumentParser(
|
|
11
|
+
prog="kitecmd",
|
|
12
|
+
description="Kite Command Utility"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
# Global version flag
|
|
16
|
+
parser.add_argument(
|
|
17
|
+
"--version", "-v",
|
|
18
|
+
action="store_true",
|
|
19
|
+
help="Show the current version of kitecmd"
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
subparsers = parser.add_subparsers(dest="command", help="Available commands")
|
|
23
|
+
|
|
24
|
+
# === test command ===
|
|
25
|
+
test_parser = subparsers.add_parser("test", help="Run a test message")
|
|
26
|
+
test_parser.add_argument("--msg", "-m", default="This is a test.", help="Custom test message")
|
|
27
|
+
test_parser.add_argument("--verbose", "-V", action="store_true", help="Show detailed system info")
|
|
28
|
+
|
|
29
|
+
# === checkupdate command ===
|
|
30
|
+
subparsers.add_parser("checkupdate", help="Check if a new version is available on PyPI")
|
|
31
|
+
|
|
32
|
+
# === version command ===
|
|
33
|
+
subparsers.add_parser("version", help="Show the current version of kitecmd")
|
|
34
|
+
|
|
35
|
+
args = parser.parse_args()
|
|
36
|
+
|
|
37
|
+
# --- Command logic ---
|
|
38
|
+
if args.version or args.command == "version":
|
|
39
|
+
show_version("kitecmd")
|
|
40
|
+
|
|
41
|
+
elif args.command == "test":
|
|
42
|
+
run_test(args)
|
|
43
|
+
|
|
44
|
+
elif args.command == "checkupdate":
|
|
45
|
+
check_for_update("kitecmd")
|
|
46
|
+
|
|
47
|
+
else:
|
|
48
|
+
parser.print_help()
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def run_test(args):
|
|
52
|
+
"""Handle the 'test' command logic."""
|
|
53
|
+
print(args.msg)
|
|
54
|
+
|
|
55
|
+
if args.verbose:
|
|
56
|
+
print("\n--- Verbose Info ---")
|
|
57
|
+
print(f"kitecmd version: {get_package_version('kitecmd')}")
|
|
58
|
+
print(f"Python version: {platform.python_version()}")
|
|
59
|
+
print(f"Platform: {platform.system()} {platform.release()}")
|
|
60
|
+
print(f"Working directory: {os.getcwd()}")
|
|
61
|
+
print(f"User: {os.getenv('USERNAME') or os.getenv('USER')}")
|
|
62
|
+
print("--------------------")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def get_package_version(package_name):
|
|
66
|
+
"""Safely get the package version."""
|
|
67
|
+
try:
|
|
68
|
+
return version(package_name)
|
|
69
|
+
except PackageNotFoundError:
|
|
70
|
+
return "Unknown"
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def show_version(package_name):
|
|
74
|
+
"""Print the installed version."""
|
|
75
|
+
print(f"kitecmd version {get_package_version(package_name)}")
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def check_for_update(package_name):
|
|
79
|
+
"""Check PyPI for the latest version of this package."""
|
|
80
|
+
current_version = get_package_version(package_name)
|
|
81
|
+
|
|
82
|
+
try:
|
|
83
|
+
resp = requests.get(f"https://pypi.org/pypi/{package_name}/json", timeout=5)
|
|
84
|
+
resp.raise_for_status()
|
|
85
|
+
latest_version = resp.json()["info"]["version"]
|
|
86
|
+
except requests.RequestException as e:
|
|
87
|
+
print(f"Could not fetch update info: {e}")
|
|
88
|
+
sys.exit(1)
|
|
89
|
+
|
|
90
|
+
if current_version == latest_version:
|
|
91
|
+
print(f"You are using the latest version ({current_version})")
|
|
92
|
+
else:
|
|
93
|
+
print("A new version is available!")
|
|
94
|
+
print(f"Installed: {current_version}")
|
|
95
|
+
print(f"Latest: {latest_version}")
|
|
96
|
+
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.
|
|
4
|
-
Summary: A
|
|
3
|
+
Version: 0.7
|
|
4
|
+
Summary: A CLI tool with update checking and other tools.
|
|
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
|
+
requests
|
|
@@ -2,10 +2,11 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="kitecmd",
|
|
5
|
-
version="0.
|
|
5
|
+
version="0.7",
|
|
6
6
|
author="coltonsr77",
|
|
7
|
-
description="A
|
|
7
|
+
description="A CLI tool with update checking and other tools.",
|
|
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",
|
kitecmd-0.5/kitecmd/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.5"
|
kitecmd-0.5/kitecmd/cli.py
DELETED
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|