Skip to content

[core] Change "arg"/"cmd" to "argument"/"command" + Change "args" from argv to "tokens"#53

Merged
forfudan merged 6 commits intomainfrom
name
Apr 16, 2026
Merged

[core] Change "arg"/"cmd" to "argument"/"command" + Change "args" from argv to "tokens"#53
forfudan merged 6 commits intomainfrom
name

Conversation

@forfudan
Copy link
Copy Markdown
Owner

@forfudan forfudan commented Apr 16, 2026

This PR standardizes ArgMojo terminology by expanding abbreviations (argargument, cmdcommand) and renaming “argv/args” concepts to “tokens” where they refer to raw CLI token streams. It updates core APIs and then propagates the naming changes through tests, docs, and examples.

Changes:

  • Rename builder/declarative identifiers and APIs (e.g., Command.argsCommand.arguments, Parsable.parse_argsParsable.parse_arguments).
  • Rename “unknown args” handling to “unknown arguments” (ParseResult.get_unknown_arguments()), and adjust callers/tests/docs.
  • Update parsing internals/docs to use “tokens” for raw CLI input (including argv() output), and refresh related documentation.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes ArgMojo terminology by expanding abbreviations (argargument, cmdcommand) and renaming “argv/args” concepts to “tokens” where they refer to raw CLI token streams. It updates core APIs and then propagates the naming changes through tests, docs, and examples.

Changes:

  • Rename builder/declarative identifiers and APIs (e.g., Command.argsCommand.arguments, Parsable.parse_argsParsable.parse_arguments).
  • Rename “unknown args” handling to “unknown arguments” (ParseResult.get_unknown_arguments()), and adjust callers/tests/docs.
  • Update parsing internals/docs to use “tokens” for raw CLI input (including argv() output), and refresh related documentation.

Reviewed changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/test_subcommands_declarative.mojo Updates local variables and declarative parsing helper usage to command / parse_arguments.
tests/test_subcommands.mojo Updates subcommand argument list access from .args to .arguments and local variable naming.
tests/test_schema_validation.mojo Updates Command.arguments usage and parse_arguments naming.
tests/test_parse.mojo Updates unknown-collection API usage to get_unknown_arguments().
tests/test_options.mojo Renames positional “cmd” field to “command” and updates unknown-collection API usage.
tests/test_interactive.mojo Renames cmd locals and updates .args.arguments loops.
tests/test_hybrid.mojo Updates hybrid examples/tests to command naming and parse_arguments naming.
tests/test_help.mojo Updates internal color field name expectations (_argument_color) and .arguments usage.
tests/test_declarative.mojo Updates declarative tests to .arguments and parse_arguments.
tests/test_completion.mojo Aligns typo-subcommand tests with new error-message behavior (no inline “Did you mean”).
src/argmojo/utils.mojo Clarifies _help_line_width() docstring to match its clamping/fallback behavior.
src/argmojo/parse_result.mojo Renames unknown tracking field/method to _unknown_arguments / get_unknown_arguments().
src/argmojo/parsable.mojo Renames parse_argsparse_arguments, and shifts local naming to command/arguments.
src/argmojo/command.mojo Broad rename: argsarguments, raw CLI inputs to tokens, and related helper/method renames.
src/argmojo/argument_wrappers.mojo Renames trait/method parameters from cmdcommand and local argargument.
pixi.toml Updates task scripts (but currently introduces a shell line-continuation issue with set -e).
examples/mgit.mojo Propagates cmdcommand naming through example builder code.
docs/user_manual.md Updates examples/tables to new API and ANSI code representation; updates unknown-collection API name.
docs/declarative_api_planning.md Updates planning doc examples to new command / parse_arguments naming.
docs/argmojo_overall_planning.md Updates planning doc references to get_unknown_arguments() and command naming.
README.md Updates hybrid bridge example and method table wording to parse_arguments / command.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pixi.toml Outdated
Comment thread pixi.toml Outdated
Comment thread src/argmojo/command.mojo
Comment thread src/argmojo/parsable.mojo Outdated
Comment thread src/argmojo/parsable.mojo Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

pixi.toml:33

  • The test task script starts with set -e\ which line-continues into the next command. In bash, this turns into set -e pixi run format ..., which changes positional parameters instead of executing the test commands, so the task will not actually run the suite as intended. Put set -e on its own line (no trailing \) / ensure the multi-line string is structured so subsequent commands are separate shell statements.
test = """ set -e\
    pixi run format \
    && pixi run package \
    && mojo run -I src -D ASSERT=all tests/test_parse.mojo \
    && mojo run -I src -D ASSERT=all tests/test_options.mojo \

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/user_manual.md Outdated
Comment thread src/argmojo/command.mojo
@forfudan forfudan merged commit ecf37b6 into main Apr 16, 2026
5 checks passed
@forfudan forfudan deleted the name branch April 16, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants