From 59564a58a756e177dbe48a2942828d584fcb1c24 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Sun, 2 Aug 2020 11:45:54 +0200 Subject: [PATCH] Only add "unless outside selected" if "outside" param is present Void confusing users if outside param is missing but still be mentioned in the help text. --- boxes/__init__.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/boxes/__init__.py b/boxes/__init__.py index f756807..7acfa9a 100755 --- a/boxes/__init__.py +++ b/boxes/__init__.py @@ -376,14 +376,20 @@ class Boxes: for arg, default in kw.items(): if arg == "x": if default is None: default = 100.0 + help = "inner width in mm" + if "outside" in kw: + help += " (unless outside selected)" self.argparser.add_argument( "--x", action="store", type=float, default=default, - help="inner width in mm (unless outside selected)") + help=help) elif arg == "y": if default is None: default = 100.0 + help = "inner depth in mm" + if "outside" in kw: + help += " (unless outside selected)" self.argparser.add_argument( "--y", action="store", type=float, default=default, - help="inner depth in mm (unless outside selected)") + help=help) elif arg == "sx": if default is None: default = "50*3" self.argparser.add_argument( @@ -404,9 +410,12 @@ class Boxes: help="""sections bottom to top in mm. See --sy for format""") elif arg == "h": if default is None: default = 100.0 + help = "inner height in mm" + if "outside" in kw: + help += " (unless outside selected)" self.argparser.add_argument( "--h", action="store", type=float, default=default, - help="inner height in mm (unless outside selected)") + help=help) elif arg == "hi": if default is None: default = 0.0 self.argparser.add_argument(