Skip to content

ArgMojo v0.6.0

Choose a tag to compare

@forfudan forfudan released this 10 May 15:20
· 7 commits to main since this release
47df395

20260510 (v0.6.0)

ArgMojo v0.6.0 introduces auto-dispatch for subcommands, improves parser behavior for mathematical-expression tokens, and migrates the codebase to Mojo v1.0.0b1.

⭐️ New in v0.6.0

  1. Add allow_negative_expressions() on Command — treats single-hyphen tokens as positional arguments when they do not conflict with registered short options. Handles mathematical expressions like -1/3*pi, -sin(2), and -e^2. This is a strict superset of allow_negative_numbers(). This is useful for mathematical tools, e.g., decimo CLI. (PR #52)
  2. Add auto-dispatch — set_run_function(handler) registers a def(ParseResult) thin raises -> None handler on a Command; execute() parses and auto-dispatches to the matching handler, eliminating manual if/elif subcommand chains. _execute_with_arguments(args) provides equivalent dispatch for tests with explicit argument lists. Works with nested subcommands, aliases, and persistent flags. (PR #53)

🔄 Mojo v1.0.0b1 migration

  • Bump Mojo dependency to ==1.0.0b1 in pixi.toml. (PR #54)
  • Migrate stored function pointers for run handlers to use the thin function effect (def(ParseResult) thin raises -> None). (PR #54)
  • Add explicit ImplicitlyDestructible bounds where required (Defaultable, Movable, Parsable generics), because trait hierarchy implications changed. (PR #54)
  • Replace deprecated len(String) usage with String.byte_length(). (PR #54)
  • Replace deprecated reflection helpers (get_type_name[T](), struct_field_*[T]()) with the unified reflect[T]() API. (PR #54)

What's Changed

  • [core][declarative] Add compile time validation on flag length, choices, and range by @forfudan in #45
  • [test][github] Split the current Github tests into 5 jobs by @forfudan in #46
  • [core] Add prelude module for convenient import by @forfudan in #47
  • [core] Add allow_negative_expressions() method for Command by @forfudan in #48
  • [core] Add auto dispatch + Extend the mgit example by @forfudan in #49
  • [core] 80-character help formatting + Fix CJK description issues in zsh and fish by @forfudan in #50
  • [example][doc] Split subcommands from main() into their own buiding functions + Update user manual by @forfudan in #51
  • [core] Enhance help and error messages with improved formatting by @forfudan in #52
  • [core] Change "arg"/"cmd" to "argument"/"command" + Change "args" from argv to "tokens" by @forfudan in #53
  • [doc] Update the user manual by @forfudan in #54
  • [core][doc] Refactor parse-related functions by adding new shared helpers and a unified parse loop + Add a document on parsing algorithm by @forfudan in #55
  • [mojo][core] Update the codebase to Mojo v1.0.0b1 by @forfudan in #56
  • [doc] Update documents for release by @forfudan in #57

Full Changelog: v0.5.0...v0.6.0