Repository navigation
Conversation
…ool annotation gives a boolean, a described parameter its type, values and range For the parameters a keyword-style command annotates `bool`, `--sort=no` now hands it False: yes/no, true/false, on/off and 1/0 in any case are booleans, and any other word is an error naming the parameter and the command. Before, the command got the string 'no', which is true - a latent bug in every such parameter. A parameter without the annotation gets the text as it is; the Python API and nested calls pass Python values and are never read. A category can describe the sensitive parameters of a command in its _cmeta (`cli_params`, per command: a type among bool, int, float and str, allowed `values`, a `min` and a `max`); the engine converts and checks exactly those, the gradual way. Two switches keep the words text as before: CMETA_CLI_TYPES=off for a process, `cli_types: false` in a category's _cmeta. utils/cli.py: cli_types_enabled(), bool_params_of() (the signature read once per function; the forward-reference form of Python 3.14's lazy annotations), typed_params_from_cli(); core.py: the call before a keyword-style function, for the request the command line made. The aops task category calls the same helper for a task's run(), so the words reach tasks and their sub-tasks (--use) as booleans too. Tests: tests/core_tests/test_cli_typed_params.py (the word table, the errors, string annotations, a bound method, the described parameters, both switches; a category of each style through the API and the command line; python -m cmeta end to end). Docs: using-cmeta.md 3.5, common-commands.md, README, the use-cmeta-cli skill, CHANGELOG. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Grigori Fursin <gfursin@gmail.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Grigori Fursin <gfursin@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cMeta v0.37.0: the words of the command line are read by what a command expects.
bool(sort: bool = False, as--helpshows),--sort=nonow hands itFalse: yes/no, true/false, on/off and 1/0 in any case are booleans, and any other word is an error naming the parameter and the command. Before, the command got the string'no', which is true. A parameter without the annotation gets the text as it is; the Python API and nested calls are never read._cmeta(cli_params, per command: a type among bool, int, float and str, allowedvalues, aminand amax); the engine converts and checks exactly those.CMETA_CLI_TYPES=offfor a process,cli_types: falsein a category's_cmeta.utils.cli.typed_params_from_cliis also called by the cmeta-aops task category for a task'srun()(cmeta-aops 0.46.0), so--x=noand--use.<key>.x=noreach tasks as booleans too.tests/core_tests/test_cli_typed_params.py. Docs: using-cmeta.md 3.5, common-commands.md, README, the use-cmeta-cli skill. See CHANGELOG.md.Verified on Windows, Ubuntu (Python 3.14, 3.9 and the free-threaded 3.14t), macOS, WSL2 and eight Linux images (python 3.9 / 3.14 / 3.15-rc, Ubuntu 22.04 / 24.04, Debian bookworm, Fedora 42, Alpine 3.21): the full engine and cmeta-aops suites.
🤖 Generated with Claude Code