From 7abc0a39205b9f374c90c4750fe6cc9b3749d7b9 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 5 Sep 2022 08:13:29 +0800 Subject: [PATCH] refactor (#450) --- gitoxide-core/src/repository/credential.rs | 9 +-------- src/plumbing/main.rs | 21 ++++++--------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/gitoxide-core/src/repository/credential.rs b/gitoxide-core/src/repository/credential.rs index 400bb5be270..0e723aeb304 100644 --- a/gitoxide-core/src/repository/credential.rs +++ b/gitoxide-core/src/repository/credential.rs @@ -5,14 +5,7 @@ pub fn function(_repo: git::Repository, action: git::credentials::program::main: // TODO: use repo for configuration use git::credentials::program::main::Action::*; git::credentials::program::main( - Some( - match action { - Get => "get", - Store => "store", - Erase => "erase", - } - .into(), - ), + Some(action.as_str().into()), std::io::stdin(), std::io::stdout(), |action, context| { diff --git a/src/plumbing/main.rs b/src/plumbing/main.rs index 1e87f64309d..93278170417 100644 --- a/src/plumbing/main.rs +++ b/src/plumbing/main.rs @@ -102,21 +102,12 @@ pub fn main() -> Result<()> { })?; match cmd { - Subcommands::Credential(cmd) => prepare_and_run( - "credential", - verbose, - progress, - progress_keep_open, - None, - move |_progress, _out, _err| { - core::repository::credential( - repository(Mode::Strict)?, - match cmd { - credential::Subcommands::Fill => git::credentials::program::main::Action::Get, - credential::Subcommands::Approve => git::credentials::program::main::Action::Store, - credential::Subcommands::Reject => git::credentials::program::main::Action::Erase, - }, - ) + Subcommands::Credential(cmd) => core::repository::credential( + repository(Mode::Strict)?, + match cmd { + credential::Subcommands::Fill => git::credentials::program::main::Action::Get, + credential::Subcommands::Approve => git::credentials::program::main::Action::Store, + credential::Subcommands::Reject => git::credentials::program::main::Action::Erase, }, ), #[cfg_attr(feature = "small", allow(unused_variables))]