refactor: simplify public API surface - #7
Merged
Conversation
Reduce `Parser` to the canonical parse and parse-from entry points, remove the alternate args and invocation parsing surfaces, and stop Argx from owning application output selection. Remove the built-in `--output` and `--fields` behavior along with the associated invocation, projection, rendering, help, completion, and schema plumbing. Structured result formatting is now left to applications, while Argx remains focused on parsing, schema discovery, handlers, and configuration. Also trim implementation-facing types from the root API, including the public `Args` marker and configuration aliases that users do not need to name.
Move schema handler plumbing behind `__private` and remove the public `Args` marker while preserving the compile-time distinction between parser roots and reusable argument groups. Also simplify invalid-value errors by folding their payload directly into `Error::InvalidValue`, and refresh affected help and UI snapshots after the earlier output API removal.
…mpletion::script(). Cli::parse() becomes the single current-process path and still handles completions automatically. The complete example is reordered accordingly.
…cked argument conversion becomes infallible on the supported Unix targets, simplifying generated binding code too.
…-end parser/help/schema/UI coverage remains responsible for observable behavior instead of freezing private metadata representation.
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
Simplifies Argx's public API and removes framework behavior that applications do not need Argx to own.
The result is a smaller, more opinionated surface focused on command-line parsing, configuration, completion, and schema discovery.
Changes
Parsertoparse,try_parse,parse_from, andtry_parse_from.--outputand--fieldshandling, field projection, output rendering, and the associated parser, schema, help, and completion plumbing.Argsmarker while preserving the distinction between parser roots and reusable argument groups in the private derive protocol.__private.Error::InvalidValueby storing its fields directly in the enum variant.Parser::handle_completionandParser::render_help;Parser::parseremains the canonical process entry point and handles completion requests automatically.Parser::render_completioninstead of exposing a parallel script-generation API.