From 92f24f534264d7cbb45ddd04bbb5a7ab714db4e3 Mon Sep 17 00:00:00 2001 From: Michael Gattozzi Date: Thu, 2 Jan 2020 13:55:18 -0500 Subject: Fix init logic for `ds init` Since the interface for `hooked init` changed to also make a language choice we need to allow the user to select the language when doing `ds init`. We also have ticket print out it ran successfully on initialization now. This was an oversight from an earlier refactor. --- src/main.rs | 18 +++++++++++++++++- ticket/src/main.rs | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 6830599..a1450dc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,6 +7,7 @@ use configamajig::*; use dialoguer::{ theme::ColorfulTheme, Checkboxes, + Select, }; use shared::find_root; #[cfg(target_family = "unix")] @@ -125,7 +126,22 @@ fn init() -> Result<()> { .map_err(|_| format_err!( "It looks like hooked is not on your $PATH. Did you run 'ds install'?" ))?; - let _ = Command::new("hooked").arg("init").spawn()?.wait()?; + + let langs = &["Python", "Ruby", "Bash"]; + let mut lang_choice = + langs[Select::with_theme(&ColorfulTheme::default()) + .with_prompt( + "Which language do you wish to use for your git hooks?", + ) + .items(langs) + .interact()?] + .to_string(); + lang_choice.make_ascii_lowercase(); + let _ = Command::new("hooked") + .arg("init") + .arg(&lang_choice) + .spawn()? + .wait()?; } Tools::Ticket => { which("ticket") diff --git a/ticket/src/main.rs b/ticket/src/main.rs index 652bd01..8b88306 100644 --- a/ticket/src/main.rs +++ b/ticket/src/main.rs @@ -103,6 +103,7 @@ fn init() -> Result<()> { debug!("Creating closed ticket directory"); fs::create_dir_all(&closed_tickets()?)?; trace!("Done initializing tickets."); + info!("Initialized repo to use ticket"); Ok(()) } -- cgit v1.2.3