read from an instance of GnuPG
This commit is contained in:
parent
6aa7e23872
commit
ec84e86659
8 changed files with 1267 additions and 35 deletions
22
src/cli.rs
22
src/cli.rs
|
|
@ -1,6 +1,10 @@
|
|||
//! The Command Line Interface definition to the git-identity subcommand
|
||||
|
||||
use std::{borrow::Cow, sync::LazyLock};
|
||||
|
||||
use clap::{ArgAction, Args, Parser, Subcommand};
|
||||
use console::Term;
|
||||
use dialoguer::theme::ColorfulTheme;
|
||||
|
||||
/// Manages multiple identities (e.g. personal, work, university, ...) in git repos for you.
|
||||
#[derive(Parser, Debug)]
|
||||
|
|
@ -15,7 +19,7 @@ pub struct Cli {
|
|||
impl Cli {
|
||||
pub fn run_subcommand(self) -> anyhow::Result<()> {
|
||||
match self.command {
|
||||
Command::SayHello(cli) => crate::subcommands::say_hello::main(self.global, cli),
|
||||
Command::Import(cli) => crate::subcommands::import::main(self.global, cli),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -32,11 +36,19 @@ pub struct GlobalArgs {
|
|||
|
||||
#[derive(Subcommand, Debug)]
|
||||
pub enum Command {
|
||||
SayHello(SayHelloCli),
|
||||
Import(ImportCli),
|
||||
}
|
||||
|
||||
/// A temporary subcommand for testing the cli
|
||||
#[derive(Parser, Debug)]
|
||||
pub struct SayHelloCli {
|
||||
pub name: String,
|
||||
pub struct ImportCli {
|
||||
/// A list of patterns to filter GPG keys with, works the same way as patterns you use with
|
||||
/// the gpg command
|
||||
#[arg(id = "PATTERN")]
|
||||
pub patterns: Vec<Cow<'static, str>>,
|
||||
}
|
||||
|
||||
pub static THEME: LazyLock<ColorfulTheme> = LazyLock::new(|| ColorfulTheme {
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
pub static STDERR: LazyLock<Term> = LazyLock::new(Term::stderr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue