Skip to content

Add ArgMojo v0.1.0 - A command-line argument parser library for Mojo#218

Merged
yetalit merged 2 commits intomodular:mainfrom
forfudan:argmojo
Feb 25, 2026
Merged

Add ArgMojo v0.1.0 - A command-line argument parser library for Mojo#218
yetalit merged 2 commits intomodular:mainfrom
forfudan:argmojo

Conversation

@forfudan
Copy link
Contributor

@forfudan forfudan commented Feb 24, 2026

Checklist

  • My recipe.yaml file specifies which version(s) of MAX is compatible with my project (see here for an example). If not, my package is compatible with both 24.5 and 24.6.
  • License file is packaged (see here for an example).
  • Set the build number to 0 (for new packages, or if the version changed).
  • Bumped the build number (if the version is unchanged).

Overview

ArgMojo (Github: https://github.com/forfudan/argmojo) provides a builder-pattern API for defining and parsing command-line arguments in Mojo. It currently supports:

  • Long options: --verbose, --output file.txt, --output=file.txt
  • Short options: -v, -o file.txt
  • Boolean flags: options that take no value
  • Positional arguments: matched by position
  • Default values: fallback when an argument is not provided
  • Required arguments: validation that mandatory args are present
  • Auto-generated help: --help / -h (no need to implement manually)
  • Version display: --version / -V (also auto-generated)
  • -- stop marker: everything after -- is treated as positional
  • Short flag merging: -abc expands to -a -b -c
  • Attached short values: -ofile.txt means -o file.txt
  • Choices validation: restrict values to a set (e.g., json, csv, table)
  • Metavar: custom display name for values in help text
  • Hidden arguments: exclude internal args from --help output
  • Count flags: -vvvget_count("verbose") == 3
  • Positional arg count validation: reject extra positional args
  • Negatable flags: --color / --no-color paired flags with .negatable()
  • Mutually exclusive groups: prevent conflicting flags (e.g., --json vs --yaml)
  • Required-together groups: enforce that related flags are provided together (e.g., --username + --password)
  • Long option prefix matching: allow abbreviated options (e.g., --verb--verbose). If the prefix is ambiguous (e.g., --ver could match both --verbose and --version), an error is raised.

@yetalit yetalit merged commit f6d1fef into modular:main Feb 25, 2026
5 checks passed
@forfudan forfudan deleted the argmojo branch February 25, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants