Repository navigation
[codex] Add custom action helpers and examples - #35
Merged
Merged
Conversation
gen740
marked this pull request as ready for review
May 11, 2026 16:28
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands cli20’s action pipeline capabilities by introducing cli::action::custom<fn> for inline/non-terminal pipeline steps, tightening callback action constraints, and improving Windows Unicode handling by moving UTF-16→UTF-8 conversion outside the parser. It also adds new example programs and documentation updates to demonstrate custom actions and git-style subcommands.
Changes:
- Add
cli::action::custom<fn>and improve action validation/type deduction helpers ininclude/cli/action.hh. - Introduce
cli::utf16_to_utf8(argc, argv)and remove Windowswchar_t* argvparsing overloads in favor of explicit conversion. - Add/refresh examples and docs: new
gitandcustom_actionexamples plus expanded docs for defining custom pipeline steps.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| TODO.md | Marks validation/action-type work as completed; adds note for nargs::rest. |
| tests/test_parse.cc | Updates tests to use action::custom and explicit UTF-16→UTF-8 conversion for Windows-wide argv tests. |
| include/cli/parser.hh | Adds Utf8Argv + utf16_to_utf8; removes wchar_t* parse overloads and updates Windows guidance. |
| include/cli/argument.hh | Updates action validation type extraction to match tuple-based Action::validate() return. |
| include/cli/action.hh | Adds ok/fail/ignore helpers, strengthens action validation, introduces action::custom, and tightens pack::callback via a concept. |
| examples/unicode_echo.cc | Uses explicit UTF-16→UTF-8 conversion in wmain before calling UTF-8 parser path. |
| examples/git.cc | Adds a git-style, command-heavy example with nested subcommands. |
| examples/custom_action.cc | Adds a reusable struct-based custom conversion example. |
| examples/advanced.cc | Updates advanced example to use cli::action::custom<fn>. |
| docs/docs/tutorial.md | Links to custom pipeline step docs. |
| docs/docs/examples/index.mdx | Adds entries for Custom Action + Git examples and renumbers sidebar ordering. |
| docs/docs/examples/git.mdx | New documentation page for the git example. |
| docs/docs/examples/env-fallback.mdx | Renumbers sidebar position/title to account for new examples. |
| docs/docs/examples/distribution-and-platform.mdx | Renumbers sidebar position/title to account for new examples. |
| docs/docs/examples/custom-action.mdx | New documentation page for the custom action example. |
| docs/docs/examples/compiler.mdx | Renumbers sidebar position/title to account for new examples. |
| docs/docs/examples/advanced.mdx | Mentions action::custom and links to Custom Action example. |
| docs/docs/actions.mdx | Expands guidance and adds a concrete action::custom example for custom pipeline steps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
gen740
enabled auto-merge (rebase)
May 11, 2026 16:50
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.
Summary
Validation