From 1b4daa0d7105467bddce18f2c978dbca30067bed Mon Sep 17 00:00:00 2001 From: bain Date: Sat, 4 Nov 2023 23:34:10 +0100 Subject: [PATCH] add shell complete --- nginx_configurator/main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nginx_configurator/main.py b/nginx_configurator/main.py index 3ae203a..5e06b48 100644 --- a/nginx_configurator/main.py +++ b/nginx_configurator/main.py @@ -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"""