aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Gattozzi <mgattozzi@gmail.com>2020-01-02 13:55:18 -0500
committerMichael Gattozzi <mgattozzi@gmail.com>2020-01-02 13:55:18 -0500
commit92f24f534264d7cbb45ddd04bbb5a7ab714db4e3 (patch)
tree3d4b7c425967f34b065673efc4e61ad2783158df
parentf768dacbdb148a9c4e846d7b113d9aea37d563c5 (diff)
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.
-rw-r--r--src/main.rs18
-rw-r--r--ticket/src/main.rs1
2 files changed, 18 insertions, 1 deletions
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(())
}