Skip to content

Commit

Permalink
fix: update to dialoguer = "0.7.1", now left and right arrow key work…
Browse files Browse the repository at this point in the history
…s finally
  • Loading branch information
ttys3 committed Jan 18, 2021
1 parent 4f09e2c commit 4286799
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
27 changes: 12 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 14 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ exclude = [
]

[dependencies]
chrono = { version = "0.4.15", features = ["serde"] }
git2 = { version = "0.13.8", default-features = false, features = [] }
handlebars = { version = "3.4.0", features = [ "dir_source" ] }
regex = "1.3.9"
chrono = { version = "0.4.19", features = ["serde"] }
git2 = { version = "0.13.15", default-features = false, features = [] }
handlebars = { version = "3.5.2", features = [ "dir_source" ] }
regex = "1.4.3"
semver = { version = "0.10.0", features = ["serde"] }
serde = { version = "1.0.115", features = ["derive"] }
serde_yaml = "0.8.13"
structopt = "0.3.16"
url = "2.1.1"
dialoguer = "0.6.2"
thiserror = "1.0.22"
serde = { version = "1.0.119", features = ["derive"] }
serde_yaml = "0.8.15"
structopt = "0.3.21"
url = "2.2.0"
dialoguer = "0.7.1"
thiserror = "1.0.23"
skim = "*"
console = "0.14.0"

[build-dependencies]
structopt = "0.3.16"
structopt = "0.3.21"

[package.metadata.deb]
depends = ""
Expand All @@ -47,3 +47,6 @@ assets = [
["target/completions/_git-cz", "/usr/share/zsh/vendor-completions/", "644"],
["target/completions/git-cz.fish", "/usr/share/fish/completions/", "644"],
]

#[patch.crates-io]
#dialoguer = { path = "../dialoguer" }
14 changes: 7 additions & 7 deletions src/cmd/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn read_single_line(
.with_prompt(prompt)
.default(default.to_string())
.allow_empty(true)
.interact()?)
.interact_text()?)
}

fn make_commit_message(
Expand Down Expand Up @@ -76,9 +76,9 @@ fn read_scope(
default: &str,
scope_regex: Regex,
) -> Result<String, Error> {
let result: String = dialoguer::Input::with_theme(theme)
let result: String = dialoguer::Input::<String>::with_theme(theme)
.with_prompt("scope")
.validate_with(move |input: &str| match scope_regex.is_match(input) {
.validate_with(move |input: &String| match scope_regex.is_match(input) {
true => Ok(()),
false => {
if input.is_empty() {
Expand All @@ -90,17 +90,17 @@ fn read_scope(
})
.default(default.to_string())
.allow_empty(true)
.interact()?;
.interact_text()?;
Ok(result)
}

fn read_description(
theme: &impl dialoguer::theme::Theme,
default: String,
) -> Result<String, Error> {
let result: String = dialoguer::Input::with_theme(theme)
let result: String = dialoguer::Input::<String>::with_theme(theme)
.with_prompt("description")
.validate_with(|input: &str| {
.validate_with(|input: &String| {
if input.len() < 10 {
Err("Description needs a length of at least 10 characters")
} else {
Expand All @@ -109,7 +109,7 @@ fn read_description(
})
.default(default)
.allow_empty(false)
.interact()?;
.interact_text()?;
Ok(result)
}

Expand Down

0 comments on commit 4286799

Please sign in to comment.