commit 10f5aca7a309207ca223c38473f9c33c2d1148df
parent b783e48a9d6682257016236a723c7b5ac4118714
Author: lash <dev@holbrook.no>
Date: Thu, 20 Apr 2023 07:56:31 +0100
Enable top-level help
Diffstat:
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
@@ -1,5 +1,7 @@
+- 0.3.6
+ * Enable --help display without subcommand
- 0.3.5
- * Fix crash using other tools than show on missing --show-missing flag.
+ * Fix crash using other tools than show on missing --show-missing flag
- 0.3.4
* Fix endless recursion bug for html issue render introduced in v0.3.3
- 0.3.3
diff --git a/piknik/runnable/cmd.py b/piknik/runnable/cmd.py
@@ -26,14 +26,18 @@ argp.add_argument('-f', '--files', dest='f', action='store_true', help='Save att
argp.add_argument('-o', '--files-dir', dest='files_dir', type=str, help='Directory to output saved files to')
argp.add_argument('-v', action='store_true', help='Turn on debug logs')
argp.add_argument('-i','--issue-id', type=str, help='Issue id to show')
-argp.add_argument('cmd', type=str, help='subcommand to execute')
+argp.add_argument('cmd', type=str, choices=['show', 'add', 'mod', 'comment'], help='subcommand to execute')
strargs = copy.copy(sys.argv[1:])
+
+have_help = False
try:
strargs.remove('-h')
+ have_help = True
except ValueError:
pass
try:
strargs.remove('--help')
+ have_help = True
except ValueError:
pass
arg, unknown = argp.parse_known_args(strargs)
@@ -48,7 +52,8 @@ elif arg.cmd == 'mod':
elif arg.cmd == 'comment':
m = importlib.import_module('piknik.cli.comment')
else:
- raise ValueError('unknown subcommand')
+ if not have_help:
+ raise ValueError('unknown subcommand')
argp = m.subparser(argp)
diff --git a/setup.cfg b/setup.cfg
@@ -1,10 +1,10 @@
[metadata]
name = piknik
-version = 0.3.5
+version = 0.3.6
description = CLI issue tracker
author = Louis Holbrook
author_email = dev@holbrook.no
-url = https://git.defalsify.org/eth-cache
+url = https://git.defalsify.org/piknik
keywords =
bugs
issues