make ent list sort issues first by state, then by ctime
This commit is contained in:
parent
e8b37cd86a
commit
ba57f629e3
1 changed files with 34 additions and 1 deletions
|
|
@ -66,11 +66,44 @@ fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<(
|
||||||
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))?;
|
||||||
let filter = entomologist::parse_filter(filter)?;
|
let filter = entomologist::parse_filter(filter)?;
|
||||||
|
let mut uuids_by_state = std::collections::HashMap::<
|
||||||
|
entomologist::issue::State,
|
||||||
|
Vec<&entomologist::issue::IssueHandle>,
|
||||||
|
>::new();
|
||||||
for (uuid, issue) in issues.issues.iter() {
|
for (uuid, issue) in issues.issues.iter() {
|
||||||
if filter.include_states.contains(&issue.state) {
|
if filter.include_states.contains(&issue.state) {
|
||||||
println!("{} {} ({:?})", uuid, issue.title(), issue.state);
|
uuids_by_state
|
||||||
|
.entry(issue.state.clone())
|
||||||
|
.or_default()
|
||||||
|
.push(uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use entomologist::issue::State;
|
||||||
|
for state in [
|
||||||
|
State::InProgress,
|
||||||
|
State::Blocked,
|
||||||
|
State::Backlog,
|
||||||
|
State::New,
|
||||||
|
State::Done,
|
||||||
|
State::WontDo,
|
||||||
|
] {
|
||||||
|
let these_uuids = uuids_by_state.entry(state.clone()).or_default();
|
||||||
|
if these_uuids.len() == 0 {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
these_uuids.sort_by(|a_id, b_id| {
|
||||||
|
let a = issues.issues.get(*a_id).unwrap();
|
||||||
|
let b = issues.issues.get(*b_id).unwrap();
|
||||||
|
a.timestamp.cmp(&b.timestamp)
|
||||||
|
});
|
||||||
|
println!("{:?}:", state);
|
||||||
|
for uuid in these_uuids {
|
||||||
|
let issue = issues.issues.get(*uuid).unwrap();
|
||||||
|
println!("{} {}", uuid, issue.title());
|
||||||
|
}
|
||||||
|
println!("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Commands::New {
|
Commands::New {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue