Compare commits
2 commits
9befbf0ade
...
fc5c3f3691
| Author | SHA1 | Date | |
|---|---|---|---|
| fc5c3f3691 | |||
| f458c9eefc |
4 changed files with 17 additions and 9 deletions
|
|
@ -1,3 +1,9 @@
|
|||
## 0.7.0a4 (2025-11-21)
|
||||
|
||||
### Feat
|
||||
|
||||
- add 'add_help' option un TiramisuCmdLineParser
|
||||
|
||||
## 0.7.0a3 (2025-10-10)
|
||||
|
||||
### Feat
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
|||
|
||||
[project]
|
||||
name = "tiramisu_cmdline_parser"
|
||||
version = "0.7.0a3"
|
||||
version = "0.7.0a4"
|
||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||
readme = "README.md"
|
||||
description = "command-line parser using Tiramisu"
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
__version__ = "0.7.0a3"
|
||||
__version__ = "0.7.0a4"
|
||||
|
|
|
|||
|
|
@ -332,6 +332,7 @@ class TiramisuCmdlineParser(ArgumentParser):
|
|||
unrestraint: bool = False,
|
||||
add_extra_options: bool = True,
|
||||
short_name_max_len: int = 1,
|
||||
add_help: bool = True,
|
||||
_forhelp: bool = False,
|
||||
**kwargs,
|
||||
):
|
||||
|
|
@ -345,6 +346,7 @@ class TiramisuCmdlineParser(ArgumentParser):
|
|||
self.add_extra_options = add_extra_options
|
||||
self.display_modified_value = display_modified_value
|
||||
self.short_name_max_len = short_name_max_len
|
||||
self.add_help = add_help
|
||||
if TiramisuHelpFormatter not in formatter_class.__mro__:
|
||||
formatter_class = type(
|
||||
"TiramisuHelpFormatter", (TiramisuHelpFormatter, formatter_class), {}
|
||||
|
|
@ -361,7 +363,7 @@ class TiramisuCmdlineParser(ArgumentParser):
|
|||
else:
|
||||
subconfig = subconfig.option(self.root)
|
||||
self.namespace = TiramisuNamespace(self.config, self.root)
|
||||
super().__init__(*args, **kwargs)
|
||||
super().__init__(*args, add_help=add_help, **kwargs)
|
||||
self.register("action", "help", _TiramisuHelpAction)
|
||||
self._config_to_argparser(
|
||||
_forhelp,
|
||||
|
|
@ -419,16 +421,16 @@ class TiramisuCmdlineParser(ArgumentParser):
|
|||
add_extra_options=self.add_extra_options,
|
||||
short_name_max_len=self.short_name_max_len,
|
||||
fullpath=self.fullpath,
|
||||
add_help=self.add_help,
|
||||
)
|
||||
namespace_, args_ = new_parser._parse_known_args(
|
||||
args_, new_parser.namespace, *others
|
||||
)
|
||||
else:
|
||||
if self._registries["action"]["help"].needs:
|
||||
# display help only when all variables assignemnt are done
|
||||
self._registries["action"]["help"].needs = False
|
||||
helper = self._registries["action"]["help"](None)
|
||||
helper.display(self)
|
||||
elif self._registries["action"]["help"].needs:
|
||||
# display help only when all variables assignemnt are done
|
||||
self._registries["action"]["help"].needs = False
|
||||
helper = self._registries["action"]["help"](None)
|
||||
helper.display(self)
|
||||
return namespace_, args_
|
||||
|
||||
def add_argument(self, *args, **kwargs):
|
||||
|
|
|
|||
Loading…
Reference in a new issue