✨ 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 {
|
impl ListCli {
|
||||||
pub(crate) async fn run(&self, credential_file: &str) -> Result<(), Error> {
|
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?;
|
let mut list = List::new(credential_file).await?;
|
||||||
log::debug!("labels from command line: {:?}", self.labels);
|
|
||||||
|
|
||||||
for label in &self.labels {
|
if !self.labels.is_empty() {
|
||||||
if let Some(l) = labels.get_label_id(label) {
|
// add labels if any specified
|
||||||
log::trace!("adding `{l}` id to labels");
|
let label_list = Labels::new(credential_file).await?;
|
||||||
list.add_label(&l);
|
|
||||||
|
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);
|
log::trace!("Max results: `{}`", self.max_results);
|
||||||
|
|||||||
Reference in New Issue
Block a user