Skip to content

Commit f048c77

Browse files
authored
Handle updates to fields that expect numbers (#31)
* Empty commit required to create a draft PR from the CLI * If required, parse field value as a number * Update version number as specified in CONTRIBUTING.md
1 parent acd9b1a commit f048c77

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "jira-terminal"
3-
version = "2.0.0"
3+
version = "2.1.0"
44
authors = ["Amrit Ghimire <[email protected]>"]
55
edition = "2018"
66
description = "This is a command line application that can be used as a personal productivity tool for interacting with JIRA"

src/jira/update.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ pub fn update_jira_ticket(ticket: String, key: String, entry: String) {
6161
} else if fields["schema"]["type"] == "array" {
6262
let values: Vec<&str> = value.split(',').collect();
6363
update_json[update_key] = values.into();
64+
} else if fields["schema"]["type"] == "number" {
65+
match value.parse::<f64>() {
66+
Ok(number) => update_json[update_key] = number.into(),
67+
Err(_) => {
68+
eprintln!("Cannot parse value as a number.");
69+
std::process::exit(1);
70+
}
71+
}
6472
} else {
6573
update_json[update_key] = value.into();
6674
}

0 commit comments

Comments
 (0)