drop join from cli
This commit is contained in:
parent
90ff10eac1
commit
f9f2f7bb65
@ -5,7 +5,7 @@ from pathlib import Path
|
||||
from types import ModuleType
|
||||
from typing import Any, Optional, Sequence
|
||||
|
||||
from . import config, flakes, join, machines, secrets, vms, webui
|
||||
from . import config, flakes, machines, secrets, vms, webui
|
||||
from .custom_logger import setup_logging
|
||||
from .dirs import get_clan_flake_toplevel
|
||||
from .ssh import cli as ssh_cli
|
||||
@ -69,9 +69,6 @@ def create_parser(prog: Optional[str] = None) -> argparse.ArgumentParser:
|
||||
)
|
||||
flakes.register_parser(parser_flake)
|
||||
|
||||
parser_join = subparsers.add_parser("join", help="join a remote clan")
|
||||
join.register_parser(parser_join)
|
||||
|
||||
parser_config = subparsers.add_parser("config", help="set nixos configuration")
|
||||
config.register_parser(parser_config)
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
# !/usr/bin/env python3
|
||||
import argparse
|
||||
import subprocess
|
||||
import urllib
|
||||
from typing import Optional
|
||||
|
||||
|
||||
def join(args: argparse.Namespace) -> None:
|
||||
# start webui in background
|
||||
uri = args.flake_uri.removeprefix("clan://")
|
||||
subprocess.run(
|
||||
["clan", "--debug", "webui", f"/join?flake={urllib.parse.quote_plus(uri)}"],
|
||||
# stdout=sys.stdout,
|
||||
# stderr=sys.stderr,
|
||||
)
|
||||
print(f"joined clan {args.flake_uri}")
|
||||
|
||||
|
||||
# takes a (sub)parser and configures it
|
||||
def register_parser(
|
||||
parser: Optional[argparse.ArgumentParser],
|
||||
) -> None:
|
||||
if parser is None:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="join a remote clan",
|
||||
)
|
||||
|
||||
# inject callback function to process the input later
|
||||
parser.set_defaults(func=join)
|
||||
|
||||
parser.add_argument(
|
||||
"flake_uri",
|
||||
help="flake uri to join",
|
||||
type=str,
|
||||
)
|
Loading…
Reference in New Issue
Block a user