From 5898032aef5dc6f66251466f75429480e1a9883c Mon Sep 17 00:00:00 2001 From: Louis PERDEREAU Date: Mon, 9 Dec 2024 15:23:47 +0100 Subject: [PATCH] feat: Add completion generation --- requirements.txt | 24 +++++++++++++----------- src/pvecontrol/__init__.py | 4 ++++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/requirements.txt b/requirements.txt index 986a483..38313e5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,13 @@ - prettytable - humanize - confuse - pyyaml - urllib3 -# proxmoxer depdends - proxmoxer>=2.0.1 - requests - requests_toolbelt - openssh_wrapper - paramiko +prettytable +humanize +confuse +pyyaml +urllib3 +shtab + +# proxmoxer depdends +proxmoxer>=2.0.1 +requests +requests_toolbelt +openssh_wrapper +paramiko diff --git a/src/pvecontrol/__init__.py b/src/pvecontrol/__init__.py index c624337..e90ecbd 100644 --- a/src/pvecontrol/__init__.py +++ b/src/pvecontrol/__init__.py @@ -5,6 +5,7 @@ import logging import re import urllib3 +import shtab from pvecontrol import actions, node, vm, task, storage from pvecontrol.cluster import PVECluster @@ -146,6 +147,9 @@ def _parser(): parser_test = subparsers.add_parser("_test") parser_test.set_defaults(func=action_test) + # shell autocomplete generation + shtab.add_argument_to(parser, ["-s", "--print-completion"]) + return parser.parse_args()