From e81c38f098a5fb71c2e9238354fdfc658f413743 Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Mon, 29 Mar 2021 13:42:45 +0200 Subject: Fix help messages program name of subsequent parsers after the first one need their "prog=" parameter specified so they do not show sys.argv[0] only. With this patch, for example: ogcli list --help Shows: usage: ogcli list [-h] {clients,scopes,modes,hardware,client} ... Instead of: usage: ogcli [-h] {clients,scopes,modes,hardware,client} ... --- cli/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cli/cli.py') diff --git a/cli/cli.py b/cli/cli.py index 87fc772..0e7c749 100644 --- a/cli/cli.py +++ b/cli/cli.py @@ -51,7 +51,7 @@ class OgCLI(): def list(self, args): choices = ['clients', 'scopes', 'modes', 'hardware', 'client'] - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser(prog='ogcli list') parser.add_argument('item', choices=choices) parsed_args = parser.parse_args([args[0]]) @@ -68,7 +68,7 @@ class OgCLI(): def set(self, args): choices = ['modes'] - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser(prog='ogcli set') parser.add_argument('item', choices=choices) parsed_args = parser.parse_args([args[0]]) -- cgit v1.2.3-18-g5258