summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Curran <brettjcurran@gmail.com>2026-02-12 15:44:10 +1100
committerBrett Curran <brettjcurran@gmail.com>2026-04-15 16:37:45 +1000
commit633be70cc583104c7df7e545b5ca9775c249114c (patch)
treece3d8028e5ba5cc4834ebb48e988491e666a6c4e
parentc56890809dca7b667fd222f1ee6328a770a8b79c (diff)
refactor project structure and add check for external user config
-rw-r--r--pyproject.toml3
-rw-r--r--src/vtt_publish/__init__.py0
-rw-r--r--src/vtt_publish/tui.py (renamed from tui.py)30
-rw-r--r--uv.lock2
4 files changed, 25 insertions, 10 deletions
diff --git a/pyproject.toml b/pyproject.toml
index 1e106ee..cfeac26 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -8,6 +8,9 @@ dependencies = [
"textual>=7.5.0",
]
+[project.scripts]
+publish = 'vtt_publish.tui:main'
+
[tool.bumpversion]
current_version = "0.2.0"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
diff --git a/src/vtt_publish/__init__.py b/src/vtt_publish/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/vtt_publish/__init__.py
diff --git a/tui.py b/src/vtt_publish/tui.py
index 095f0d5..f70e96f 100644
--- a/tui.py
+++ b/src/vtt_publish/tui.py
@@ -13,7 +13,7 @@ import time
HISTORY_FILE = ".publish_history.json"
-CONFIG = {
+DEFAULT_CONFIG = {
"remote_user": "user",
"remote_host": "192.168.1.1",
"remote_base_path": "/var/www/vtt/assets",
@@ -25,6 +25,14 @@ CONFIG = {
}
}
+config_path = Path.home() / ".vtt_publish.json"
+if config_path.exists():
+ with open(config_path, "r") as f:
+ user_config = json.load(f)
+ CONFIG = DEFAULT_CONFIG | user_config
+else:
+ CONFIG = DEFAULT_CONFIG
+
# --- MOCK DATA GENERATOR (Creates fake files for testing) ---
def create_mock_files():
@@ -405,13 +413,13 @@ class PublisherApp(App):
try:
self.log_message(f"Run: {' '.join(cmd)}") # Debug print
- # # Run actual command
- # result = subprocess.run(
- # cmd,
- # capture_output=True,
- # text=True,
- # check=True
- # )
+ # Run actual command
+ result = subprocess.run(
+ cmd,
+ capture_output=True,
+ text=True,
+ check=True
+ )
# 5. Update UI on success
self.log_message(f"SUCCESS: {filename}")
@@ -435,6 +443,10 @@ class PublisherApp(App):
self.log_message("History updated.")
-if __name__ == "__main__":
+def main():
app = PublisherApp()
app.run()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/uv.lock b/uv.lock
index 3c8cdb0..a691c8f 100644
--- a/uv.lock
+++ b/uv.lock
@@ -120,7 +120,7 @@ wheels = [
[[package]]
name = "vtt-publish"
-version = "0.1.1"
+version = "0.2.0"
source = { virtual = "." }
dependencies = [
{ name = "textual" },