Harness the power of signify(1) to sign arbitrary git objects
0
fork

Configure Feed

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

generate shell completions

+38
+10
Cargo.lock
··· 181 181 ] 182 182 183 183 [[package]] 184 + name = "clap_complete" 185 + version = "4.5.40" 186 + source = "registry+https://github.com/rust-lang/crates.io-index" 187 + checksum = "ac2e663e3e3bed2d32d065a8404024dad306e699a04263ec59919529f803aee9" 188 + dependencies = [ 189 + "clap", 190 + ] 191 + 192 + [[package]] 184 193 name = "clap_derive" 185 194 version = "4.5.18" 186 195 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 339 348 dependencies = [ 340 349 "anyhow", 341 350 "clap", 351 + "clap_complete", 342 352 "either", 343 353 "git2", 344 354 "libsignify",
+1
Cargo.toml
··· 6 6 [dependencies] 7 7 anyhow = "1.0.95" 8 8 clap = { version = "4.5.23", features = ["derive", "env"] } 9 + clap_complete = "4.5.40" 9 10 either = "1.13.0" 10 11 git2 = "0.19.0" 11 12 minisign = "0.7.9"
+7
src/main.rs
··· 4 4 mod push; 5 5 mod raw; 6 6 mod rev_lookup; 7 + mod shell_completions; 7 8 mod sign; 8 9 mod utils; 9 10 mod verify; ··· 77 78 /// Revision whose signature will be looked up 78 79 git_rev: String, 79 80 }, 81 + /// Generate shell completions 82 + ShellCompletions { 83 + /// The shell to generate completions for 84 + shell: clap_complete::aot::Shell, 85 + }, 80 86 } 81 87 82 88 #[derive(Subcommand)] ··· 134 140 public_key, 135 141 git_rev: rev, 136 142 } => rev_lookup::command(public_key, rev), 143 + Action::ShellCompletions { shell } => shell_completions::command(shell), 137 144 } 138 145 }
+20
src/shell_completions.rs
··· 1 + //! Generate shell completions. 2 + 3 + use std::io; 4 + 5 + use anyhow::Result; 6 + use clap::CommandFactory; 7 + use clap_complete::aot::{generate, Shell}; 8 + 9 + use super::Args; 10 + 11 + /// Execute the `shell-completions` command. 12 + pub fn command(shell: Shell) -> Result<()> { 13 + generate( 14 + shell, 15 + &mut Args::command(), 16 + "git-signify", 17 + &mut io::stdout(), 18 + ); 19 + Ok(()) 20 + }