You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/changelog.md
+83-99Lines changed: 83 additions & 99 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,78 +6,79 @@ This document tracks all notable changes to ArgMojo, including new features, API
6
6
Comment out unreleased changes here. This file will be edited just before each release to reflect the final changelog for that version.
7
7
-->
8
8
9
-
<!--
10
-
## 20260303 (v0.3.0)
9
+
## 20260305 (v0.3.0)
11
10
12
-
ArgMojo v0.3.0 enables shell completion script generation for Bash, Zsh, and Fish.
11
+
ArgMojo v0.3.0 adds shell completion, typo suggestions, mutual implication, hidden subcommands, `NO_COLOR` support, and several builder-method improvements. Internally the code is decomposed into smaller helpers and a new `utils.mojo` module; several API names are refined for consistency. Two breaking changes affect call sites that use `nargs`, `max`, or `range` (now compile-time parameters) and the renamed methods listed below.
12
+
13
+
ArgMojo v0.3.0 is compatible with Mojo v0.26.1.
13
14
14
15
### ⭐️ New in v0.3.0
15
-
1. completion (PR #4)
16
-
1. typo suggestions (PR #3)
17
-
1. Command aliases (PR #5)
18
-
1. Range clamping with warning message if users pass out-of-range values (#6)
19
-
1. Compile-time parameter APIs: `.max[ceiling]()`, `.range[min, max]()`, `.number_of_values[N]()` replace the former runtime methods (PR #8). **Breaking change**: callers must update call sites.
20
-
1. Hidden subcommands — `Command.hidden()` excludes a subcommand from help output, shell completions, available-commands error messages, and typo suggestions while keeping it dispatchable by exact name or alias (PR #9)
21
-
1. `NO_COLOR` environment variable support — when `NO_COLOR` is set (any value, including empty), all ANSI colour output from `_generate_help()`, `_warn()`, `_error()`, and `_error_with_usage()` is suppressed, following the [no-color.org](https://no-color.org/) standard (PR #9)
22
-
1. Mutual implication — `Command.implies(trigger, implied)` automatically sets one argument when another is present. Supports chained implications (A → B → C) with cycle detection at registration time. Works with flags, count arguments, and integrates with existing constraints (`required_if`, `mutually_exclusive`) (PR #10)
23
16
24
-
### 🦋 Changed in v0.2.0
25
-
-->
17
+
1. Implement shell completion script generation for Bash, Zsh, and Fish, with a built-in `--completions <shell>` flag that emits a ready-to-source script (PR #4).
18
+
2. Allow disabling the built-in flag (`disable_default_completions()`), customising the trigger name (`completions_name()`), or exposing completions as a subcommand (`completions_as_subcommand()`) (PR #4).
19
+
3. Add Levenshtein-distance based "did you mean ...?" suggestions for misspelled long options and subcommand names (PR #3).
20
+
4. Implement `command_aliases()` on `Command` to register alternative names for subcommands. Aliases are shown in help, accepted during dispatch, and included in shell completions and typo suggestions (PR #5).
21
+
5. Add `.clamp()` modifier for `.range[min, max]()` -- out-of-range values are adjusted to the nearest boundary with a warning instead of a hard error (PR #6).
22
+
6. Move count-ceiling enforcement (`.max[N]()`) and range validation into the `_validate()` phase so all post-parse checks run in a single pass (PR #6).
23
+
7. Parameterise `.max[ceiling]()`, `.range[min, max]()`, and `.number_of_values[N]()` as compile-time parameters, enabling build-time validation of invalid values (PR #8).
24
+
8. Add `Command.hidden()` builder method. Hidden subcommands are excluded from help output, shell completions, "Available commands" error messages, and typo suggestions, while remaining dispatchable by exact name or alias (PR #9).
25
+
9. Honour the `NO_COLOR` environment variable (any value, including empty). When set, all ANSI colour output from help, warning, and error messages is suppressed, following the no-color.org standard (PR #9).
26
+
10. Add `Command.implies(trigger, implied)` to automatically set one argument when another is present. Supports chained implications (A -> B -> C) with cycle detection at registration time. Works with flags and count arguments, and integrates with existing constraints (`required_if`, `mutually_exclusive`) (PR #10).
27
+
28
+
### 🦋 Changed in v0.3.0
29
+
30
+
1.`parse_args()` renamed to `parse_arguments()` (PR #5).
31
+
2.`help_on_no_args()` renamed to `help_on_no_arguments()` (PR #5).
32
+
3.`.nargs()` renamed to `.number_of_values()` and `nargs_count` field renamed to `_number_of_values` (PR #5).
33
+
4. Several `Argument` and `ParseResult` attributes are now underscore-prefixed (private). Public builder methods are unchanged (PR #7).
34
+
5. Decompose `parse_args()` into four sub-methods: `_parse_long_option()`, `_parse_short_single()`, `_parse_short_merged()`, `_dispatch_subcommand()` (PR #2).
35
+
6. Decompose `_generate_help()` into five sub-methods: `_help_usage_line()`, `_help_positionals_section()`, `_help_options_section()`, `_help_commands_section()`, `_help_tips_section()` (PR #2).
36
+
7. Extract ANSI colour constants and utility functions into a new internal module `utils.mojo` (PR #2).
37
+
8. Rename example files to avoid confusion: `git.mojo` -> `mgit.mojo`, `grep.mojo` -> `mgrep.mojo`.
38
+
9. Add `examples/demo.mojo` -- a comprehensive showcase of all ArgMojo features in a single CLI (PR #7).
- Add `tests/test_completion.mojo` with comprehensive tests for Bash, Zsh, and Fish script generation (PR #4).
44
+
- Add `tests/test_implies.mojo` covering basic, chained, and multi-target implications, cycle detection, and constraint integration (PR #10).
45
+
- Add builder method compatibility section to the user manual with an ASCII tree, Mermaid diagram, and compatibility table (PR #11).
46
+
- Set up GitHub Actions workflow for automatic wiki synchronisation from `docs/user_manual.md`.
47
+
- Update user manual to cover all new features.
48
+
49
+
---
26
50
27
51
## 20260228 (v0.2.0)
28
52
29
-
ArgMojo v0.2.0 is a major release that transforms the library from a single-command parser into a full **subcommand-capable CLI framework**. It introduces hierarchical subcommands with automatic dispatch, persistent (global) flags with bidirectional sync, negative number passthrough, colored error messages, custom tips, and significant help/UX improvements. The public API is also refined: `Arg`→`Argument`, `Result`→`ParseResult` (old names kept as aliases). Two complete example CLIs (`mgrep` and `mgit`) replace the previous demo.
53
+
ArgMojo v0.2.0 is a major release that transforms the library from a single-command parser into a full subcommand-capable CLI framework. It introduces hierarchical subcommands with automatic dispatch, persistent (global) flags with bidirectional sync, negative number passthrough, colored error messages, custom tips, and significant help/UX improvements. The public API is also refined: `Arg`->`Argument`, `Result`->`ParseResult` (old names kept as aliases). Two complete example CLIs (`mgrep` and `mgit`) replace the previous demo.
30
54
31
55
ArgMojo v0.2.0 is compatible with Mojo v0.26.1.
32
56
33
57
### ⭐️ New in v0.2.0
34
58
35
-
**Subcommands:**
36
-
37
59
1. Implement full subcommand support with `add_subcommand()` API, hierarchical dispatch, and nested subcommands (e.g., `git remote add`).
38
-
1. Auto-register a `help` subcommand so that `app help <command>` works out of the box; opt out with `disable_help_subcommand()`.
39
-
1. Add `allow_positional_with_subcommands()` guard — prevents accidental mixing of positional args and subcommands on the same `Command`, following the cobra/clap convention. Requires explicit opt-in.
40
-
1. Add `subcommand` and `subcommand_result` fields on `ParseResult` with `has_subcommand_result()` / `get_subcommand_result()` accessors.
41
-
1. Add `command_aliases()` builder method for subcommand short names (e.g., `clone` → `cl`). Aliases dispatch to the canonical subcommand, appear in help output, shell completions, and typo suggestions.
42
-
43
-
**Persistent flags:**
44
-
45
-
1. Add `.persistent()` builder method on `Argument` to mark a flag as global.
46
-
1. Persistent args are automatically injected into child commands and support bidirectional sync: flags set before the subcommand push down to the child, and flags set after the subcommand bubble up to the root.
47
-
1. Detect conflicting long/short names between parent persistent args and child local args at registration time (`add_subcommand()` raises an error).
48
-
49
-
**Negative number passthrough:**
50
-
51
-
1. Recognize negative numeric tokens like `-3.14` or `-42` as positional values instead of unknown short options.
52
-
1. Add `allow_negative_numbers()` opt-in on `Command` for explicit control.
53
-
54
-
**Custom tips:**
55
-
56
-
1. Add `add_tip()` API on `Command` to attach user-defined tips that render as a dedicated section at the bottom of help output.
57
-
58
-
**Error handling:**
59
-
60
-
1. Colored error and warning messages — ANSI-styled stderr output for all parse errors.
61
-
1. Unknown subcommand error now lists all available commands.
62
-
1. Errors inside child parse are prefixed with the full command path (e.g., `git remote add: ...`).
60
+
2. Auto-register a `help` subcommand so that `app help <command>` works out of the box; opt out with `disable_help_subcommand()`.
61
+
3. Add `allow_positional_with_subcommands()` guard -- prevents accidental mixing of positional args and subcommands on the same `Command`, following the cobra/clap convention. Requires explicit opt-in.
62
+
4. Add `subcommand` and `subcommand_result` fields on `ParseResult` with `has_subcommand_result()` / `get_subcommand_result()` accessors.
63
+
5. Add `command_aliases()` builder method for subcommand short names (e.g., `clone` -> `cl`). Aliases dispatch to the canonical subcommand, appear in help output, shell completions, and typo suggestions.
64
+
6. Add `.persistent()` builder method on `Argument` to mark a flag as global.
65
+
7. Persistent args are automatically injected into child commands and support bidirectional sync: flags set before the subcommand push down to the child, and flags set after the subcommand bubble up to the root.
66
+
8. Detect conflicting long/short names between parent persistent args and child local args at registration time (`add_subcommand()` raises an error).
67
+
9. Recognize negative numeric tokens like `-3.14` or `-42` as positional values instead of unknown short options. Add `allow_negative_numbers()` opt-in on `Command` for explicit control.
68
+
10. Add `add_tip()` API on `Command` to attach user-defined tips that render as a dedicated section at the bottom of help output.
69
+
11. Colored error and warning messages -- ANSI-styled stderr output for all parse errors.
70
+
12. Unknown subcommand error now lists all available commands.
71
+
13. Errors inside child parse are prefixed with the full command path (e.g., `git remote add: ...`).
63
72
64
73
### 🦋 Changed in v0.2.0
65
74
66
-
**API rename:**
67
-
68
75
1. Rename `Arg` struct to `Argument` and `Result` struct to `ParseResult`. The old names are kept as aliases for backward compatibility.
1. Long option prefix matching — `--verb` auto-resolves to `--verbose` when unambiguous.
117
-
1. Conditional requirements — `--output` required only when `--save` is present.
118
-
1. Numeric range validation — `.range[1, 65535]()` validates value is within bounds.
119
-
120
-
**Groups:**
121
-
122
-
1. Mutually exclusive groups — prevent conflicting flags (e.g., `--json` vs `--yaml`).
123
-
1. Required-together groups — enforce that related flags are provided together (e.g., `--username` + `--password`).
124
-
1. One-required groups — require at least one argument from a group.
125
-
126
-
**Collection:**
127
-
128
-
1. Append / collect action — `--tag x --tag y` collects repeated options into a list with `.append()`.
129
-
1. Value delimiter — `--env dev,staging,prod` splits by delimiter into a list with `.delimiter(",")`.
130
-
1. Multi-value options (nargs) — `--point 10 20` consumes N consecutive values with `.number_of_values[N]()` (breaking change from v0.1.0: replaces the old `.number_of_values(N)` runtime form, which no longer works).
131
-
1. Key-value map option — `--define key=value` builds a `Dict` with `.key_value()`.
132
-
133
-
**Help & display:**
134
-
135
-
1. Auto-generated help with `--help` / `-h` / `-?`, dynamic column alignment, pixi-style ANSI colours, and customisable header/arg colours.
136
-
1. Help on no args — optionally show help when invoked with no arguments.
137
-
1. Version display with `--version` / `-V`.
138
-
1. Metavar — custom display name for values in help text.
139
-
1. Hidden arguments — exclude internal args from help output.
140
-
141
-
**Other:**
142
-
143
-
1. Aliases for long names — `.aliases(["color"])` for `--colour` / `--color`.
144
-
1. Deprecated arguments — `.deprecated("Use --format instead")` prints warning to stderr.
102
+
2. Boolean flags that take no value.
103
+
3. Positional arguments matched by position, with optional default values.
104
+
4. Required argument validation.
105
+
5.`--` stop marker -- everything after `--` is treated as positional.
106
+
6. Short flag merging -- `-abc` expands to `-a -b -c`.
107
+
7. Attached short values -- `-ofile.txt` means `-o file.txt`.
0 commit comments