cli: List issues consistent
Help the user by ordering issue listing by their creation time to make it consistent.
This commit is contained in:
parent
3e2cf83f9b
commit
e0241050f8
|
|
@ -338,6 +338,24 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let mut all = Vec::new();
|
||||||
|
for result in issues.all()? {
|
||||||
|
let (id, issue, _) = result?;
|
||||||
|
|
||||||
|
if Some(true) == assignee.map(|a| !issue.assigned().any(|v| v == Did::from(a))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
all.push((id, issue))
|
||||||
|
}
|
||||||
|
|
||||||
|
all.sort_by(|(id1, i1), (id2, i2)| {
|
||||||
|
let by_timestamp = i2.timestamp().cmp(&i1.timestamp());
|
||||||
|
let by_id = id1.cmp(id2);
|
||||||
|
|
||||||
|
by_timestamp.then(by_id)
|
||||||
|
});
|
||||||
|
|
||||||
let mut t = term::Table::new(term::table::TableOptions::bordered());
|
let mut t = term::Table::new(term::table::TableOptions::bordered());
|
||||||
t.push([
|
t.push([
|
||||||
term::format::dim(String::from("●")),
|
term::format::dim(String::from("●")),
|
||||||
|
|
@ -350,18 +368,10 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
]);
|
]);
|
||||||
t.divider();
|
t.divider();
|
||||||
|
|
||||||
for result in issues.all()? {
|
for (id, issue) in all {
|
||||||
let (id, issue, _) = result?;
|
let assigned: String = issue
|
||||||
let assigned: Vec<_> = issue.assigned().collect();
|
.assigned()
|
||||||
let state = issue.state();
|
.map(|p| term::format::did(&p).to_string())
|
||||||
|
|
||||||
if Some(true) == assignee.map(|a| !assigned.contains(&Did::from(a))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
let assigned: String = assigned
|
|
||||||
.iter()
|
|
||||||
.map(|p| term::format::did(p).to_string())
|
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join(", ");
|
.join(", ");
|
||||||
|
|
||||||
|
|
@ -369,7 +379,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
tags.sort();
|
tags.sort();
|
||||||
|
|
||||||
t.push([
|
t.push([
|
||||||
match state {
|
match issue.state() {
|
||||||
State::Open => term::format::positive("●").into(),
|
State::Open => term::format::positive("●").into(),
|
||||||
State::Closed { .. } => term::format::negative("●").into(),
|
State::Closed { .. } => term::format::negative("●").into(),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue