feat: complete professional cli with full lifecycle and tests
This commit is contained in:
parent
a7d97227d3
commit
34ba255024
12 changed files with 112 additions and 9 deletions
|
|
@ -63,11 +63,45 @@ def ingress_add(config, domain, ip, port, https):
|
|||
mgr.add(domain, ip, port, https)
|
||||
click.echo(f"Added ingress for {domain}")
|
||||
|
||||
@ingress.command(name='remove')
|
||||
@click.argument('domain')
|
||||
@click.pass_obj
|
||||
def ingress_remove(config, domain):
|
||||
mgr = IngressManager(config)
|
||||
mgr.remove(domain)
|
||||
click.echo(f"Removed ingress for {domain}")
|
||||
|
||||
@ingress.command(name='list')
|
||||
@click.pass_obj
|
||||
def ingress_list(config):
|
||||
mgr = IngressManager(config)
|
||||
click.echo(mgr.list())
|
||||
|
||||
@cli.group()
|
||||
def router():
|
||||
"""Manage Router Port Forwards"""
|
||||
pass
|
||||
|
||||
@router.command(name='add')
|
||||
@click.argument('name')
|
||||
@click.argument('proto')
|
||||
@click.argument('ext_port')
|
||||
@click.argument('int_ip')
|
||||
@click.argument('int_port')
|
||||
@click.pass_obj
|
||||
def router_add(config, name, proto, ext_port, int_ip, int_port):
|
||||
mgr = RouterManager(config)
|
||||
mgr.add_forward(name, proto, ext_port, int_ip, int_port)
|
||||
click.echo(f"Added port forward {name}")
|
||||
|
||||
@router.command(name='remove')
|
||||
@click.argument('section')
|
||||
@click.pass_obj
|
||||
def router_remove(config, section):
|
||||
mgr = RouterManager(config)
|
||||
mgr.remove_forward(section)
|
||||
click.echo(f"Removed port forward {section}")
|
||||
|
||||
@router.command(name='list')
|
||||
@click.pass_obj
|
||||
def router_list(config):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue