Skip to content

Commit

Permalink
fix: conflicting option names
Browse files Browse the repository at this point in the history
  • Loading branch information
ysthakur committed Aug 8, 2023
1 parent 68658f7 commit 7bb9b0f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# man-completions

This is an unfinished project to parse manpages to get completions for Zsh, and other shells.
Also generates JSON files, in case your shell isn't supported, so you can process
it and generate completions yourself.

Ported from [Fish's completions script](https://github.com/fish-shell/fish-shell/blob/master/share/tools/create_manpage_completions.py)
9 changes: 5 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use std::process::Command;

#[derive(Debug, Clone, ValueEnum)]
enum Shell {
/// Generate completions for Zsh
Zsh,
/// Not a shell, but output the parsed options as JSON
Json,
Expand All @@ -24,10 +25,6 @@ enum Shell {
#[derive(Debug, Parser)]
#[command(version, about, long_about)]
struct CLI {
/// Shell to generate completions for
#[arg(short, long)]
shell: Shell,

/// Directory to output completions to
#[arg(short, long)]
out: PathBuf,
Expand All @@ -51,7 +48,11 @@ struct CLI {

/// A particular command to generate completions for. If omitted, generates
/// completions for all found commands.
#[arg(short, long)]
cmd: Option<String>,

/// Shell to generate completions for
shell: Shell,
}

fn section_num_parser(s: &str) -> core::result::Result<u8, String> {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn test() {
let cmd =
cmd
.env("MANPATH", &in_dir)
.args(["--shell", shell, "--out", &out_dir.display().to_string()]);
.args([shell, "--out", &out_dir.display().to_string()]);
cmd.assert().success();
}

Expand Down

0 comments on commit 7bb9b0f

Please sign in to comment.