✨ feat(list): add label filtering to list command
- allow users to filter tasks by label when listing tasks - refactor label handling to support multiple labels
This commit is contained in:
committed by
Jeremiah Russell
parent
40c3f6a7a5
commit
58de6397ce
@@ -17,18 +17,21 @@ pub struct ListCli {
|
||||
|
||||
impl ListCli {
|
||||
pub(crate) async fn run(&self, credential_file: &str) -> Result<(), Error> {
|
||||
let mut labels = Labels::new(credential_file).await?;
|
||||
labels.get_labels().await?;
|
||||
log::trace!("labels found and setup {labels:#?}");
|
||||
|
||||
let mut list = List::new(credential_file).await?;
|
||||
log::debug!("labels from command line: {:?}", self.labels);
|
||||
|
||||
for label in &self.labels {
|
||||
if let Some(l) = labels.get_label_id(label) {
|
||||
log::trace!("adding `{l}` id to labels");
|
||||
list.add_label(&l);
|
||||
if !self.labels.is_empty() {
|
||||
// add labels if any specified
|
||||
let label_list = Labels::new(credential_file).await?;
|
||||
|
||||
log::trace!("labels found and setup {label_list:#?}");
|
||||
log::debug!("labels from command line: {:?}", self.labels);
|
||||
let mut label_ids = Vec::new();
|
||||
for label in &self.labels {
|
||||
if let Some(id) = label_list.get_label_id(label) {
|
||||
label_ids.push(id)
|
||||
}
|
||||
}
|
||||
list.add_labels(label_ids.as_slice());
|
||||
}
|
||||
|
||||
log::trace!("Max results: `{}`", self.max_results);
|
||||
|
||||
Reference in New Issue
Block a user