From 3b7bd7ac6911eb89816a56b6c529836502a99689 Mon Sep 17 00:00:00 2001 From: joncrall <jon.crall@kitware.com> Date: Thu, 9 May 2024 22:32:10 -0400 Subject: [PATCH] Allow special options to be passed to cli --- CHANGELOG.md | 2 ++ scriptconfig/config.py | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b1aa6b..ced5fc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## Version 0.7.15 - Unreleased +### Added +* Allow special options to be passed to cli ## Version 0.7.14 - Released 2024-04-15 diff --git a/scriptconfig/config.py b/scriptconfig/config.py index c07169e..d4854cc 100644 --- a/scriptconfig/config.py +++ b/scriptconfig/config.py @@ -341,7 +341,7 @@ class Config(ub.NiceRepr, DictLike, metaclass=MetaConfig): @classmethod def cli(cls, data=None, default=None, argv=None, strict=True, - cmdline=True, autocomplete='auto'): + cmdline=True, autocomplete='auto', special_options=True): """ Create a commandline aware config instance. @@ -390,7 +390,7 @@ class Config(ub.NiceRepr, DictLike, metaclass=MetaConfig): # prevents adding clean options for control flow. self = cls(_dont_call_post_init=True) self.load(data, cmdline=cmdline, default=default, strict=strict, - autocomplete=autocomplete) + autocomplete=autocomplete, special_options=special_options) return self @classmethod @@ -564,7 +564,8 @@ class Config(ub.NiceRepr, DictLike, metaclass=MetaConfig): self._alias_map = None def load(self, data=None, cmdline=False, mode=None, default=None, - strict=False, autocomplete=False, _dont_call_post_init=False): + strict=False, autocomplete=False, _dont_call_post_init=False, + special_options=True): """ Updates the configuration from a given data source. @@ -738,7 +739,7 @@ class Config(ub.NiceRepr, DictLike, metaclass=MetaConfig): # should override them IF they exist on in sys.argv, but not if # they don't? read_argv_kwargs = { - 'special_options': True, + 'special_options': special_options, 'strict': strict, 'autocomplete': autocomplete, 'argv': None, -- GitLab