mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-22 11:13:09 +02:00
Add Replica::get_working_set_index and use it
This is probably ridiculously inefficient, as it will load the working set for each and every task listed. Optimize later!
This commit is contained in:
parent
2dd86edd4a
commit
1c5e9b009b
3 changed files with 34 additions and 5 deletions
|
@ -30,11 +30,16 @@ define_subcommand! {
|
|||
|
||||
subcommand_invocation! {
|
||||
fn run(&self, command: &CommandInvocation) -> Fallible<()> {
|
||||
let task = shared::get_task(&mut command.get_replica(), &self.task)?;
|
||||
let mut replica = command.get_replica();
|
||||
let task = shared::get_task(&mut replica, &self.task)?;
|
||||
let uuid = task.get_uuid();
|
||||
|
||||
let mut t = Table::new();
|
||||
t.set_format(table::format());
|
||||
t.add_row(row![b->"Uuid", task.get_uuid()]);
|
||||
t.add_row(row![b->"Uuid", uuid]);
|
||||
if let Some(i) = replica.get_working_set_index(uuid)? {
|
||||
t.add_row(row![b->"Id", i]);
|
||||
}
|
||||
t.add_row(row![b->"Description", task.get_description()]);
|
||||
t.add_row(row![b->"Status", task.get_status()]);
|
||||
t.printstd();
|
||||
|
|
|
@ -23,11 +23,16 @@ define_subcommand! {
|
|||
|
||||
subcommand_invocation! {
|
||||
fn run(&self, command: &CommandInvocation) -> Fallible<()> {
|
||||
let mut replica = command.get_replica();
|
||||
let mut t = Table::new();
|
||||
t.set_format(table::format());
|
||||
t.set_titles(row![b->"uuid", b->"description"]);
|
||||
for (uuid, task) in command.get_replica().all_tasks().unwrap() {
|
||||
t.add_row(row![uuid, task.get_description()]);
|
||||
t.set_titles(row![b->"id", b->"description"]);
|
||||
for (uuid, task) in replica.all_tasks().unwrap() {
|
||||
let mut id = uuid.to_string();
|
||||
if let Some(i) = replica.get_working_set_index(&uuid)? {
|
||||
id = i.to_string();
|
||||
}
|
||||
t.add_row(row![id, task.get_description()]);
|
||||
}
|
||||
t.printstd();
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue