add shell complete

This commit is contained in:
bain 2023-11-04 23:34:10 +01:00
parent 1f28369805
commit 1b4daa0d71
Signed by: bain
GPG key ID: 31F0F25E3BED0B9B

View file

@ -252,8 +252,11 @@ def new(ctx):
ctx.invoke(reload)
def shell_complete_service(ctx, param, incomplete):
return [file.name for file in certs.get_site_files(NGINX_DIR) if incomplete in file.name]
@cli.command()
@click.argument("service")
@click.argument("service", shell_complete=shell_complete_service)
@click.pass_context
def edit(ctx, service: str):
"""Edit a service"""
@ -287,7 +290,7 @@ def edit(ctx, service: str):
@cli.command()
@click.argument("service")
@click.argument("service", shell_complete=shell_complete_service)
@click.pass_context
def delete(ctx, service: str):
"""Delete a service"""