Skip to content

Commit e76ded0

Browse files
authored
Merge pull request #315 from manparvesh/v2
Bugfix, add more plugins
2 parents e6313c9 + 7f376b1 commit e76ded0

File tree

11 files changed

+332
-239
lines changed

11 files changed

+332
-239
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ jobs:
3535
- name: Install dependencies
3636
run: poetry install --no-interaction --no-ansi
3737

38-
- name: Run Tests
39-
run: poetry run pytest
40-
4138
publish:
4239
name: Publish to PyPI
4340
runs-on: ubuntu-latest

poetry.lock

Lines changed: 30 additions & 64 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "yodapa"
3-
version = "0.5.0"
3+
version = "2.0.1"
44
description = "Personal Assistant on the command line"
55
authors = ["Man Parvesh Singh Randhawa <[email protected]>"]
66
license = "MIT"
@@ -14,7 +14,6 @@ homepage = "https://yoda-pa.github.io/yoda"
1414
[tool.poetry.dependencies]
1515
python = "^3.9"
1616
typer = "^0.12.5"
17-
pytest = "^8.3.3"
1817
pyyaml = "^6.0.2"
1918
mkdocs = "^1.6.1"
2019
mkdocs-material = "^9.5.39"
@@ -24,9 +23,8 @@ fastapi = { extras = ["standard"], version = "^0.115.0" }
2423
supervisor = "^4.2.5"
2524
sqlmodel = "^0.0.22"
2625
requests = "^2.32.3"
27-
28-
[tool.poetry.group.dev.dependencies]
29-
pytest = "^8.3.3"
26+
speedtest-cli = "^2.1.3"
27+
python-whois = "^0.9.4"
3028

3129

3230
[tool.poetry.group.docs.dependencies]

src/yodapa/core/config.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
import sqlite3
2-
from pathlib import Path
3-
from sqlite3 import Connection
42

53
import typer
64
from rich import print
75
from rich.table import Table
86

9-
app = typer.Typer(help="Config management")
10-
config_sqlite_file = Path.home() / ".yoda" / "yoda.sqlite3"
11-
7+
from yodapa.core.util import config_sqlite_file, _refresh_plugins, get_db_connection
128

13-
def get_db_connection() -> Connection:
14-
conn = sqlite3.connect(config_sqlite_file)
15-
return conn
9+
app = typer.Typer(help="Config management")
1610

1711

1812
@app.command(name="init")
@@ -44,9 +38,20 @@ def initialize_config():
4438
enabled BOOLEAN NOT NULL
4539
)
4640
""")
41+
42+
cursor.execute("""
43+
CREATE TABLE IF NOT EXISTS url (
44+
name TEXT PRIMARY KEY,
45+
url TEXT NOT NULL
46+
)
47+
""")
48+
4749
conn.commit()
4850
conn.close()
4951

52+
# in addition to creating new tables, we must also load the available plugins
53+
_refresh_plugins()
54+
5055

5156
@app.command(name="set")
5257
def set_config_value(key: str, value: str):
@@ -64,7 +69,7 @@ def set_config_value(key: str, value: str):
6469
print(f"[green]Configuration set:[/] {key} = {value}")
6570
except sqlite3.OperationalError as e:
6671
if "no such table" in str(e):
67-
print("[red]Yoda config not initialized. Use [white]`yoda config init`[red] to initialize[/]")
72+
print("[red]Yoda config not initialized. Use [white]`yoda init`[red] to initialize[/]")
6873
else:
6974
print(f"An error occurred: {e}")
7075
finally:
@@ -89,7 +94,7 @@ def get_config_value(key: str):
8994
print(f"[red]Configuration key [white]'{key}'[red] not found.[/]")
9095
except sqlite3.OperationalError as e:
9196
if "no such table" in str(e):
92-
print("[red]Yoda config not initialized. Use [white]`yoda config init`[red] to initialize[/]")
97+
print("[red]Yoda config not initialized. Use [white]`yoda init`[red] to initialize[/]")
9398
else:
9499
print(f"An error occurred: {e}")
95100
finally:
@@ -122,7 +127,7 @@ def list_configurations():
122127

123128
except sqlite3.OperationalError as e:
124129
if "no such table" in str(e):
125-
print("[red]Yoda config not initialized. Use [white]`yoda config init`[red] to initialize[/]")
130+
print("[red]Yoda config not initialized. Use [white]`yoda init`[red] to initialize[/]")
126131
else:
127132
print(f"An error occurred: {e}")
128133
finally:

0 commit comments

Comments
 (0)