cmd_runner_fmt.as_fixed() now accepts list of args (#9893)
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.15) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py2.7) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py3.10) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py3.5) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/3/) (push) Waiting to run
import-galaxy / Test to import built collection artifact with Galaxy importer (push) Waiting to run
Verify REUSE / check (push) Waiting to run

* cmd_runner_fmt.as_fixed() now accepts list of args

* update CmdRunner guide

* add changelog frag

* Update changelogs/fragments/9893-cmdrunner-as-fixed-args.yml

* fix overdoing in as_fixed()
This commit is contained in:
Alexei Znamensky 2025-03-22 09:04:59 +13:00 committed by GitHub
parent e3d92491a3
commit 9286b60182
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 48 additions and 14 deletions

View file

@ -78,7 +78,9 @@ def as_list(ignore_none=None, min_len=0, max_len=None):
return _ArgFormat(func, ignore_none=ignore_none)
def as_fixed(args):
def as_fixed(*args):
if len(args) == 1 and is_sequence(args[0]):
args = args[0]
return _ArgFormat(lambda value: _ensure_list(args), ignore_none=False, ignore_missing_value=True)