don't
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(cred): generate shell completions

Signed-off-by: tjh <x@tjh.dev>

tjh a7c0abec c7aee0c1

+28 -1
+1
Cargo.lock
··· 2048 2048 version = "0.0.0" 2049 2049 dependencies = [ 2050 2050 "clap", 2051 + "clap_complete", 2051 2052 "data-encoding", 2052 2053 "directories", 2053 2054 "exn",
+1
crates/gordian-cred/Cargo.toml
··· 30 30 tokio = { version = "1.48.0", features = ["rt"] } 31 31 toml = "0.9.8" 32 32 tracing-subscriber = { version = "0.3.20", features = ["env-filter"] } 33 + clap_complete = "4.5.65"
+2
crates/gordian-cred/src/commands.rs
··· 1 1 pub mod auth; 2 + pub mod generate; 2 3 pub mod git_credential; 3 4 pub mod git_setup; 4 5 5 6 pub use auth::*; 7 + pub use generate::Generate; 6 8 pub use git_credential::*; 7 9 pub use git_setup::*;
+21
crates/gordian-cred/src/commands/generate.rs
··· 1 + /// Generate shell completions 2 + #[derive(clap::Args)] 3 + pub struct Generate { 4 + /// Shell name 5 + shell: clap_complete::Shell, 6 + } 7 + 8 + impl crate::RunCommand for Generate { 9 + type Error = std::convert::Infallible; 10 + 11 + fn run(self) -> Result<(), Self::Error> { 12 + use clap::CommandFactory as _; 13 + 14 + let mut command = crate::Arguments::command(); 15 + let name = command.get_name().to_string(); 16 + 17 + clap_complete::generate(self.shell, &mut command, name, &mut std::io::stdout()); 18 + 19 + Ok(()) 20 + } 21 + }
+3 -1
crates/gordian-cred/src/main.rs
··· 4 4 mod config; 5 5 6 6 use clap::{Parser, Subcommand}; 7 - use commands::{Auth, GitCredential, Install}; 7 + use commands::{Auth, Generate, GitCredential, Install}; 8 8 use exn::{Exn, ResultExt as _}; 9 9 use tracing_subscriber::{EnvFilter, layer::SubscriberExt as _, util::SubscriberInitExt as _}; 10 10 ··· 19 19 Auth(Auth), 20 20 GitCredential(GitCredential), 21 21 Install(Install), 22 + Generate(Generate), 22 23 } 23 24 24 25 #[derive(Debug)] ··· 43 42 Self::Auth(sc) => sc.run().or_raise(err)?, 44 43 Self::GitCredential(sc) => sc.run().or_raise(err)?, 45 44 Self::Install(sc) => sc.run().or_raise(err)?, 45 + Self::Generate(generate) => generate.run().unwrap(), 46 46 } 47 47 Ok(()) 48 48 }