update
This commit is contained in:
parent
6b0a4f7b9c
commit
7d70e72516
1 changed files with 1 additions and 9 deletions
|
@ -62,20 +62,12 @@ Config = TypeAdapter(dict[str, Entry])
|
||||||
@click.option("--ssh-command", default="ssh")
|
@click.option("--ssh-command", default="ssh")
|
||||||
@click.option("--telnet-command", default="telnet")
|
@click.option("--telnet-command", default="telnet")
|
||||||
@click.option("--config", type=click.Path(exists=True, path_type=pathlib.Path))
|
@click.option("--config", type=click.Path(exists=True, path_type=pathlib.Path))
|
||||||
@click.option("--name", type=str)
|
|
||||||
def main(
|
def main(
|
||||||
ssh_command: str,
|
ssh_command: str,
|
||||||
telnet_command: str,
|
telnet_command: str,
|
||||||
config: pathlib.Path,
|
config: pathlib.Path,
|
||||||
name: str,
|
|
||||||
):
|
):
|
||||||
cfg = Config.validate_json(config.read_bytes())
|
entry = Entry.validate_model_json(config.read_bytes())
|
||||||
|
|
||||||
if name not in cfg:
|
|
||||||
sys.stderr.write("unknown config entry!\n")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
entry = cfg[name]
|
|
||||||
|
|
||||||
a = pyansi.ANSI()
|
a = pyansi.ANSI()
|
||||||
sys.stdout.write(a.Title(text=f"{entry.name} - {entry.address}"))
|
sys.stdout.write(a.Title(text=f"{entry.name} - {entry.address}"))
|
||||||
|
|
Loading…
Reference in a new issue