forked from informalsystems/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLI auto-completions (informalsystems#1789)
cli: Add completions command using clap_complete
- Loading branch information
Showing
6 changed files
with
45 additions
and
17 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
.changelog/unreleased/improvements/ibc-relayer-cli/1789-cli-completions.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- Add `completions` CLI command to generate shell auto-completion scripts. | ||
([#1789](https://github.com/informalsystems/ibc-rs/pull/1789)) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use crate::entry::EntryPoint; | ||
use abscissa_core::clap::Parser; | ||
use abscissa_core::Runnable; | ||
use clap::IntoApp; | ||
use clap_complete::Shell; | ||
use std::io; | ||
|
||
#[derive(Debug, Parser)] | ||
pub struct CompletionsCmd { | ||
#[clap(arg_enum)] | ||
shell: Shell, | ||
} | ||
|
||
impl Runnable for CompletionsCmd { | ||
fn run(&self) { | ||
let mut app = EntryPoint::into_app(); | ||
let app_name = app.get_name().to_owned(); | ||
clap_complete::generate(self.shell, &mut app, app_name, &mut io::stdout()); | ||
} | ||
} |
This file contains 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