Adding handoff to Victor Viral
This commit is contained in:
+8
-3
@@ -156,6 +156,11 @@ Examples:
|
||||
default=None,
|
||||
help="For handoff: path to video file (overrides output_video in project.json)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--prod",
|
||||
action="store_true",
|
||||
help="Target production server (GNOMMOWEB_PROD_URL / GNOMMOWEB_PROD_API_KEY)",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -218,13 +223,13 @@ Examples:
|
||||
return cmd_master(project_path, args.verbose, args.channel)
|
||||
elif action == "push":
|
||||
from .push import cmd_push
|
||||
return cmd_push(project_path, args.verbose, args.force)
|
||||
return cmd_push(project_path, args.verbose, args.force, args.prod)
|
||||
elif action == "pull":
|
||||
from .pull import cmd_pull
|
||||
return cmd_pull(project_path, args.verbose, args.force)
|
||||
return cmd_pull(project_path, args.verbose, args.force, args.prod)
|
||||
elif action == "handoff":
|
||||
from .handoff import cmd_handoff
|
||||
return cmd_handoff(project_path, args.verbose, args.file)
|
||||
return cmd_handoff(project_path, args.verbose, args.file, args.prod)
|
||||
|
||||
except GnommoError as e:
|
||||
print(f"Error: {e}", file=sys.stderr)
|
||||
|
||||
+14
-9
@@ -65,18 +65,23 @@ def _write_sync(project_path: Path, data: dict):
|
||||
json.dump(data, f, indent=2)
|
||||
|
||||
|
||||
def cmd_handoff(project_path: Path, verbose: bool = False, file_override: str | None = None) -> int:
|
||||
def cmd_handoff(project_path: Path, verbose: bool = False, file_override: str | None = None, prod: bool = False) -> int:
|
||||
_load_env_file()
|
||||
|
||||
api_url = os.environ.get("GNOMMOWEB_URL", "").rstrip("/")
|
||||
api_key = os.environ.get("GNOMMOWEB_API_KEY", "")
|
||||
if prod:
|
||||
api_url = os.environ.get("GNOMMOWEB_PROD_URL", "").rstrip("/")
|
||||
api_key = os.environ.get("GNOMMOWEB_PROD_API_KEY", "")
|
||||
if not api_url: print("Error: GNOMMOWEB_PROD_URL is not set.", file=sys.stderr); return 1
|
||||
if not api_key: print("Error: GNOMMOWEB_PROD_API_KEY is not set.", file=sys.stderr); return 1
|
||||
else:
|
||||
api_url = os.environ.get("GNOMMOWEB_URL", "").rstrip("/")
|
||||
api_key = os.environ.get("GNOMMOWEB_API_KEY", "")
|
||||
if not api_url: print("Error: GNOMMOWEB_URL is not set.", file=sys.stderr); return 1
|
||||
if not api_key: print("Error: GNOMMOWEB_API_KEY is not set.", file=sys.stderr); return 1
|
||||
|
||||
if not api_url:
|
||||
print("Error: GNOMMOWEB_URL is not set.", file=sys.stderr)
|
||||
return 1
|
||||
if not api_key:
|
||||
print("Error: GNOMMOWEB_API_KEY is not set.", file=sys.stderr)
|
||||
return 1
|
||||
if verbose:
|
||||
target = "production" if prod else "local"
|
||||
print(f" → {target}: {api_url}")
|
||||
|
||||
project_file = project_path / "project.json"
|
||||
if not project_file.exists():
|
||||
|
||||
+14
-9
@@ -73,18 +73,23 @@ def _parse_ts(ts_str) -> datetime | None:
|
||||
return None
|
||||
|
||||
|
||||
def cmd_pull(project_path: Path, verbose: bool = False, force: bool = False) -> int:
|
||||
def cmd_pull(project_path: Path, verbose: bool = False, force: bool = False, prod: bool = False) -> int:
|
||||
_load_env_file()
|
||||
|
||||
api_url = os.environ.get("GNOMMOWEB_URL", "").rstrip("/")
|
||||
api_key = os.environ.get("GNOMMOWEB_API_KEY", "")
|
||||
if prod:
|
||||
api_url = os.environ.get("GNOMMOWEB_PROD_URL", "").rstrip("/")
|
||||
api_key = os.environ.get("GNOMMOWEB_PROD_API_KEY", "")
|
||||
if not api_url: print("Error: GNOMMOWEB_PROD_URL is not set.", file=sys.stderr); return 1
|
||||
if not api_key: print("Error: GNOMMOWEB_PROD_API_KEY is not set.", file=sys.stderr); return 1
|
||||
else:
|
||||
api_url = os.environ.get("GNOMMOWEB_URL", "").rstrip("/")
|
||||
api_key = os.environ.get("GNOMMOWEB_API_KEY", "")
|
||||
if not api_url: print("Error: GNOMMOWEB_URL is not set.", file=sys.stderr); return 1
|
||||
if not api_key: print("Error: GNOMMOWEB_API_KEY is not set.", file=sys.stderr); return 1
|
||||
|
||||
if not api_url:
|
||||
print("Error: GNOMMOWEB_URL is not set.", file=sys.stderr)
|
||||
return 1
|
||||
if not api_key:
|
||||
print("Error: GNOMMOWEB_API_KEY is not set.", file=sys.stderr)
|
||||
return 1
|
||||
if verbose:
|
||||
target = "production" if prod else "local"
|
||||
print(f" → {target}: {api_url}")
|
||||
|
||||
project_file = project_path / "project.json"
|
||||
if not project_file.exists():
|
||||
|
||||
+14
-9
@@ -86,18 +86,23 @@ def _parse_ts(ts_str) -> datetime | None:
|
||||
return None
|
||||
|
||||
|
||||
def cmd_push(project_path: Path, verbose: bool = False, force: bool = False) -> int:
|
||||
def cmd_push(project_path: Path, verbose: bool = False, force: bool = False, prod: bool = False) -> int:
|
||||
_load_env_file()
|
||||
|
||||
api_url = os.environ.get("GNOMMOWEB_URL", "").rstrip("/")
|
||||
api_key = os.environ.get("GNOMMOWEB_API_KEY", "")
|
||||
if prod:
|
||||
api_url = os.environ.get("GNOMMOWEB_PROD_URL", "").rstrip("/")
|
||||
api_key = os.environ.get("GNOMMOWEB_PROD_API_KEY", "")
|
||||
if not api_url: print("Error: GNOMMOWEB_PROD_URL is not set.", file=sys.stderr); return 1
|
||||
if not api_key: print("Error: GNOMMOWEB_PROD_API_KEY is not set.", file=sys.stderr); return 1
|
||||
else:
|
||||
api_url = os.environ.get("GNOMMOWEB_URL", "").rstrip("/")
|
||||
api_key = os.environ.get("GNOMMOWEB_API_KEY", "")
|
||||
if not api_url: print("Error: GNOMMOWEB_URL is not set.", file=sys.stderr); return 1
|
||||
if not api_key: print("Error: GNOMMOWEB_API_KEY is not set.", file=sys.stderr); return 1
|
||||
|
||||
if not api_url:
|
||||
print("Error: GNOMMOWEB_URL is not set.", file=sys.stderr)
|
||||
return 1
|
||||
if not api_key:
|
||||
print("Error: GNOMMOWEB_API_KEY is not set.", file=sys.stderr)
|
||||
return 1
|
||||
if verbose:
|
||||
target = "production" if prod else "local"
|
||||
print(f" → {target}: {api_url}")
|
||||
|
||||
project_file = project_path / "project.json"
|
||||
if not project_file.exists():
|
||||
|
||||
Reference in New Issue
Block a user