Skip to content

Commit

Permalink
refactor: use for loop to generate completions file (#1869)
Browse files Browse the repository at this point in the history
  • Loading branch information
Integral-Tech authored Oct 31, 2024
1 parent e3c9111 commit a510673
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions yazi-boot/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ fn main() -> Result<(), Box<dyn Error>> {
let out = "completions";

std::fs::create_dir_all(out)?;
generate_to(Shell::Bash, cmd, bin, out)?;
generate_to(Shell::Fish, cmd, bin, out)?;
generate_to(Shell::Zsh, cmd, bin, out)?;
generate_to(Shell::Elvish, cmd, bin, out)?;
generate_to(Shell::PowerShell, cmd, bin, out)?;
for sh in [Shell::Bash, Shell::Fish, Shell::Zsh, Shell::Elvish, Shell::PowerShell] {
generate_to(sh, cmd, bin, out)?;
}

generate_to(clap_complete_nushell::Nushell, cmd, bin, out)?;
generate_to(clap_complete_fig::Fig, cmd, bin, out)?;

Expand Down
9 changes: 4 additions & 5 deletions yazi-cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ fn main() -> Result<(), Box<dyn Error>> {
let out = "completions";

std::fs::create_dir_all(out)?;
generate_to(Shell::Bash, cmd, bin, out)?;
generate_to(Shell::Fish, cmd, bin, out)?;
generate_to(Shell::Zsh, cmd, bin, out)?;
generate_to(Shell::Elvish, cmd, bin, out)?;
generate_to(Shell::PowerShell, cmd, bin, out)?;
for sh in [Shell::Bash, Shell::Fish, Shell::Zsh, Shell::Elvish, Shell::PowerShell] {
generate_to(sh, cmd, bin, out)?;
}

generate_to(clap_complete_nushell::Nushell, cmd, bin, out)?;
generate_to(clap_complete_fig::Fig, cmd, bin, out)?;

Expand Down

0 comments on commit a510673

Please sign in to comment.