Closed
Conversation
`Document` and `Command` share 7 fields: `arguments`, `options`, `commands`, `exitCodes`, `examples`, `interactive`, and `metadata`. The `title` and `description` fields of `CliInfo` serve the same purpose as the `name` and `description` fields of `Command`. `Document` models the root command. Most CLIs model the root command the same way as subcommands — or with a subclass of the object used for subcommands. For example, - [alecthomas/kong](https://github.com/alecthomas/kong) (Go): the root CLI and commands are all modeled as Go structs using Kong's grammar - [oclif/oclif](https://github.com/oclif/oclif) (TS): the root CLI and commands are all modeled as classes that extend `Command` - [spf13/cobra](https://github.com/spf13/cobra) (Go): the root command and subcommands are all instances of `*cobra.Command` - [clap-rs/clap](https://github.com/clap-rs/clap) (Rust): the root and subcommands are all `clap::Command` values composed into a tree - [remkop/picocli](https://github.com/remkop/picocli) (Java): the root command and subcommands are all `@Command`-annotated classes/objects - [commander-js/commander.js](https://github.com/commander-js/commander.js) (JS): the “program” and its subcommands are all `Command` objects - [CLIUtils/CLI11](https://github.com/CLIUtils/CLI11) (C++): the root app and subcommands are all `CLI::App` objects (subcommands are Apps too!) - [dotnet/command-line-api](https://github.com/dotnet/command-line-api) (C#): the root command, `System.CommandLine.RootCommand`, extends `System.CommandLine.Command` - [pallets/click](https://github.com/pallets/click) (Python): the root command, `click.Group`, extends `click.Command` This change 1. feat: adds `summary` to `Command` 2. BREAKING: renames `CliInfo#title` to `CliInfo#name` 3. BREAKING: hoists `name`, `summary`, and `description` up from `CliInfo` to `Document` 4. refactor: extends `Document` from `Command`
4f45d58 to
5a8586e
Compare
Contributor
|
@boblail Thanks for engaging. Pull requests, however, require an open issue. An issue is opened when a discussion reaches a consensus. I will therefore close this PR. I hope you understand. |
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.
DocumentandCommandshare 7 fields:arguments,options,commands,exitCodes,examples,interactive, andmetadata.The
titleanddescriptionfields ofCliInfoserve the same purpose as thenameanddescriptionfields ofCommand.Documentmodels the root command. Most CLIs model the root command the same way as subcommands — or with a subclass of the object used for subcommands. For example,Command*cobra.Commandclap::Commandvalues composed into a tree@Command-annotated classes/objectsCommandobjectsCLI::Appobjects (subcommands are Apps too!)System.CommandLine.RootCommand, extendsSystem.CommandLine.Commandclick.Group, extendsclick.CommandThis change:
summarytoCommandCliInfo#titletoCliInfo#namename,summary, anddescriptionup fromCliInfotoDocumentDocumentfromCommandresolves #70