Skip to content

Commit

Permalink
Refine runtime generation based on feedback provided
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimian committed Jan 6, 2025
1 parent d01774b commit efd8d59
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Unreleased
### Features
- Allow for completion and man page generation at runtime
- Add `--generate` option to generate the man page and shell completions at runtime
- Add support for Elvish and Nushell shell completions

## [0.23.1] - 2025-01-02
Expand Down
25 changes: 19 additions & 6 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,24 @@ Example: --print=Hb"
pub curl_long: bool,

/// Generate shell completions or man pages.
#[arg(long, value_name = "KIND")]
#[arg(
long,
value_name = "KIND",
hide_possible_values = true,
long_help = "\
Generate shell completions or man pages. Possible values are:
complete-bash
complete-elvish
complete-fish
complete-nushell
complete-powershell
complete-zsh
man
Example: xh --generate=complete-bash > xh.bash",
conflicts_with = "raw_method_or_url"
)]
pub generate: Option<Generate>,

/// Print help.
Expand All @@ -385,11 +402,7 @@ Example: --print=Hb"
///
/// A leading colon works as shorthand for localhost. ":8000" is equivalent
/// to "localhost:8000", and ":/path" is equivalent to "localhost/path".
#[clap(
value_name = "[METHOD] URL",
required_unless_present = "generate",
conflicts_with = "generate"
)]
#[clap(value_name = "[METHOD] URL", required = true)]
raw_method_or_url: Option<String>,

/// Optional key-value pairs to be included in the request.
Expand Down

0 comments on commit efd8d59

Please sign in to comment.