Compare commits

..

No commits in common. "7e6322067481fd48dedd98170a8a4619ec2cc920" and "343e43a7627c2e77a30fa123cde0432d7ae40d8a" have entirely different histories.

2 changed files with 5 additions and 20 deletions

View file

@ -43,7 +43,6 @@ fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<(
println!("{} {} ({:?})", uuid, issue.title(), issue.state); println!("{} {} ({:?})", uuid, issue.title(), issue.state);
} }
} }
Commands::New { Commands::New {
description: Some(description), description: Some(description),
} => { } => {
@ -51,41 +50,35 @@ fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<(
issue.set_description(description)?; issue.set_description(description)?;
println!("created new issue '{}'", issue.title()); println!("created new issue '{}'", issue.title());
} }
Commands::New { description: None } => { Commands::New { description: None } => {
let mut issue = entomologist::issue::Issue::new(issues_dir)?; let mut issue = entomologist::issue::Issue::new(issues_dir)?;
issue.edit_description()?; issue.edit_description()?;
println!("created new issue '{}'", issue.title()); println!("created new issue '{}'", issue.title());
} }
Commands::Edit { issue_id } => { Commands::Edit { issue_id } => {
let mut issues = let mut issues =
entomologist::issues::Issues::new_from_dir(std::path::Path::new(issues_dir))?; entomologist::issues::Issues::new_from_dir(std::path::Path::new(issues_dir))?;
match issues.get_mut_issue(issue_id) { match issues.issues.get_mut(issue_id) {
Some(issue) => { Some(issue) => {
issue.edit_description()?; issue.edit_description()?;
} }
None => { None => {
return Err(anyhow::anyhow!("issue {} not found", issue_id)); println!("issue {} not found", issue_id);
} }
} }
} }
Commands::Show { issue_id } => { Commands::Show { issue_id } => {
let issues = let issues =
entomologist::issues::Issues::new_from_dir(std::path::Path::new(issues_dir))?; entomologist::issues::Issues::new_from_dir(std::path::Path::new(issues_dir))?;
match issues.get_issue(issue_id) { match issues.issues.get(issue_id) {
Some(issue) => { Some(issue) => {
println!("issue {}", issue_id); println!("issue {}", issue_id);
println!("state: {:?}", issue.state); println!("state {:?}", issue.state);
if let Some(dependencies) = &issue.dependencies {
println!("dependencies: {:?}", dependencies);
}
println!(""); println!("");
println!("{}", issue.description); println!("{}", issue.description);
} }
None => { None => {
return Err(anyhow::anyhow!("issue {} not found", issue_id)); println!("issue {} not found", issue_id);
} }
} }
} }

View file

@ -35,14 +35,6 @@ impl Issues {
self.issues.insert(uuid, issue); self.issues.insert(uuid, issue);
} }
pub fn get_issue(&self, issue_id: &str) -> Option<&crate::issue::Issue> {
self.issues.get(issue_id)
}
pub fn get_mut_issue(&mut self, issue_id: &str) -> Option<&mut crate::issue::Issue> {
self.issues.get_mut(issue_id)
}
fn parse_config(&mut self, config_path: &std::path::Path) -> Result<(), ReadIssuesError> { fn parse_config(&mut self, config_path: &std::path::Path) -> Result<(), ReadIssuesError> {
let config_contents = std::fs::read_to_string(config_path)?; let config_contents = std::fs::read_to_string(config_path)?;
let config: Config = toml::from_str(&config_contents)?; let config: Config = toml::from_str(&config_contents)?;