Skip to content

Commit b4d4347

Browse files
committed
chore: bump version to 0.1.2 and cleanup codebase
1 parent 26ea917 commit b4d4347

4 files changed

Lines changed: 22 additions & 19 deletions

File tree

hmv/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
__tool_name__ = "HMV-CLI"
6-
__version__ = "0.1.0"
6+
__version__ = "0.1.2"
77
__author__ = "Ouba"
88
__github_url__ = "https://github.com/setyanoegraha/hackmyvm-commandlineinterface"
99

hmv/modules/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99

1010
__tool_name__ = "HMV-CLI"
11-
__version__ = "0.1.0"
11+
__version__ = "0.1.2"
1212
__author__ = "Ouba"
1313
__github_url__ = "https://github.com/setyanoegraha/hackmyvm-commandlineinterface"
1414

hmv/modules/auth.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,48 +17,51 @@ def __init__(self):
1717
os.makedirs(self.config_dir)
1818

1919
def save_credentials(self, username, password):
20-
"""Save username to file and password to system keychain."""
2120
try:
2221
with open(self.config_file, "w") as f:
2322
json.dump({"username": username}, f)
24-
23+
2524
keyring.set_password(self.app_name, username, password)
26-
console.print("[bold green][+][/bold green] Credentials saved successfully!")
25+
console.print("[bold green][][/bold green] Configuration saved successfully!")
2726

2827
except NoKeyringError:
29-
console.print("[bold red][!][/bold red] Error: No recommended keyring backend was found.")
30-
console.print("[yellow][*][/yellow] Linux users: Please install [bold white]keyrings.alt[/bold white] or a secret service.")
31-
console.print(" Command: [cyan]pip install keyrings.alt[/cyan]")
28+
console.print("[bold red][!][/bold red] Error: Keyring storage system not found.")
29+
console.print("[yellow][*][/yellow] Linux users, please use the following commands:")
30+
console.print("\n [bold cyan]If using pipx:[/bold cyan]")
31+
console.print(" [white]pipx inject hmv keyrings.alt[/white]")
32+
console.print("\n [bold cyan]If using uv:[/bold cyan]")
33+
console.print(" [white]uv tool install --with keyrings.alt git+https://github.com/setyanoegraha/hackmyvm-commandlineinterface.git[/white]")
34+
3235
except Exception as e:
33-
console.print(f"[bold red][!][/bold red] Failed to save password to system vault.")
34-
console.print(f"[dim]Error detail: {e}[/dim]")
36+
console.print(f"[bold red][!][/bold red] Failed to save configuration to system vault.")
37+
console.print(f"[dim]Error Detail: {e}[/dim]")
3538

3639
async def get_session(self):
37-
"""Establish and return an authenticated HTTPX session."""
3840
if not os.path.exists(self.config_file):
39-
console.print("[bold red][!][/bold red] Configuration missing. Please run 'hmv config' first.")
41+
console.print("[bold red][!][/bold red] Configuration not found. Run '[cyan]hmv config[/cyan]' first.")
4042
return None
4143

4244
try:
4345
with open(self.config_file, "r") as f:
4446
username = json.load(f).get("username")
45-
47+
4648
password = keyring.get_password(self.app_name, username)
4749
except NoKeyringError:
48-
console.print("[bold red][!][/bold red] Keyring backend not found. Run [cyan]pip install keyrings.alt[/cyan]")
50+
console.print("[bold red][!][/bold red] Keyring backend not found.")
51+
console.print("[yellow][*][/yellow] Run: [white]pipx inject hmv keyrings.alt[/white]")
4952
return None
5053
except Exception as e:
51-
console.print(f"[bold red][!][/bold red] Error accessing vault: {e}")
54+
console.print(f"[bold red][!][/bold red] Error while accessing vault: {e}")
5255
return None
5356

5457
if not password:
55-
console.print("[bold red][!][/bold red] Password not found. Please run 'hmv config' again.")
58+
console.print("[bold red][!][/bold red] Password not found. Please run '[cyan]hmv config[/cyan]' again.")
5659
return None
5760

5861
user_agent = (
5962
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
6063
"AppleWebKit/537.36 (KHTML, like Gecko) "
61-
"Chrome/120.0.0.0 Safari/537.36 HMV-CLI/0.1.0"
64+
"Chrome/120.0.0.0 Safari/537.36 HMV-CLI/0.1.2"
6265
)
6366

6467
timeout = httpx.Timeout(60.0, connect=15.0)
@@ -78,7 +81,7 @@ async def get_session(self):
7881
if "Logout" in resp.text:
7982
return client
8083

81-
console.print("[bold red][!][/bold red] Authentication failed. Check your credentials.")
84+
console.print("[bold red][!][/bold red] Authentication failed. Please check your username and password.")
8285
await client.aclose()
8386
return None
8487
except Exception as e:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "hmv"
7-
version = "0.1.0"
7+
version = "0.1.2"
88
description = "HMV-CLI: HackMyVM Advanced Versatile Operations CLI - A powerful toolkit for machine management"
99
authors = [
1010
{name = "Ouba"}

0 commit comments

Comments
 (0)