add ent edit
This commit is contained in:
parent
09373cda56
commit
ba0862f5a6
1 changed files with 15 additions and 0 deletions
|
|
@ -23,6 +23,9 @@ enum Commands {
|
||||||
|
|
||||||
/// Create a new issue.
|
/// Create a new issue.
|
||||||
New { description: Option<String> },
|
New { description: Option<String> },
|
||||||
|
|
||||||
|
/// Edit the description of an issue.
|
||||||
|
Edit { issue_id: String },
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<()> {
|
fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<()> {
|
||||||
|
|
@ -46,6 +49,18 @@ fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<(
|
||||||
issue.edit_description()?;
|
issue.edit_description()?;
|
||||||
println!("created new issue '{}'", issue.title());
|
println!("created new issue '{}'", issue.title());
|
||||||
}
|
}
|
||||||
|
Commands::Edit { issue_id } => {
|
||||||
|
let mut issues =
|
||||||
|
entomologist::issues::Issues::new_from_dir(std::path::Path::new(issues_dir))?;
|
||||||
|
match issues.issues.get_mut(issue_id) {
|
||||||
|
Some(issue) => {
|
||||||
|
issue.edit_description()?;
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
println!("issue {} not found", issue_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue