mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-24 23:46:41 +02:00
Allow for custom tag instead of +next
This commit is contained in:
parent
b1f3c0c48e
commit
03bb726811
2 changed files with 17 additions and 3 deletions
|
@ -2014,6 +2014,9 @@ impl TaskwarriorTui {
|
|||
|
||||
pub fn task_tag_next(&mut self) -> Result<(), String> {
|
||||
let app = TaskwarriorTui::new("next").unwrap();
|
||||
let tag_name = &self.config.uda_tag_next_name;
|
||||
let ptag_name = format!("+{}", tag_name);
|
||||
let ntag_name = format!("-{}", tag_name);
|
||||
if self.tasks.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
|
@ -2022,10 +2025,10 @@ impl TaskwarriorTui {
|
|||
|
||||
for task_uuid in &task_uuids {
|
||||
if let Some(task) = app.task_by_uuid(*task_uuid) {
|
||||
let mut tag_to_set = "+next";
|
||||
let mut tag_to_set = &ptag_name;
|
||||
for tag in task.tags().unwrap() {
|
||||
if tag == "next" {
|
||||
tag_to_set = "-next";
|
||||
if tag == tag_name {
|
||||
tag_to_set = &ntag_name;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ pub struct Config {
|
|||
pub uda_shortcuts: Vec<String>,
|
||||
pub uda_background_process: String,
|
||||
pub uda_background_process_period: usize,
|
||||
pub uda_tag_next_name: String,
|
||||
pub uda_task_report_prompt_on_delete: bool,
|
||||
pub uda_task_report_prompt_on_done: bool,
|
||||
}
|
||||
|
@ -111,6 +112,7 @@ impl Config {
|
|||
let uda_style_context_active = uda_style_context_active.unwrap_or_default();
|
||||
let uda_style_report_completion_pane =
|
||||
uda_style_report_completion_pane.unwrap_or_else(|| Style::default().bg(Color::Rgb(223, 223, 223)));
|
||||
let uda_tag_next_name = Self::get_uda_tag_next_name(data);
|
||||
let uda_task_report_prompt_on_delete = Self::get_uda_task_report_prompt_on_delete(data);
|
||||
let uda_task_report_prompt_on_done = Self::get_uda_task_report_prompt_on_done(data);
|
||||
|
||||
|
@ -145,6 +147,7 @@ impl Config {
|
|||
uda_shortcuts,
|
||||
uda_background_process,
|
||||
uda_background_process_period,
|
||||
uda_tag_next_name,
|
||||
uda_task_report_prompt_on_delete,
|
||||
uda_task_report_prompt_on_done,
|
||||
})
|
||||
|
@ -542,6 +545,14 @@ impl Config {
|
|||
.parse::<usize>()
|
||||
.unwrap_or(4)
|
||||
}
|
||||
|
||||
fn get_uda_tag_next_name(data: &str) -> String {
|
||||
let tag_name = Self::get_config("uda.taskwarrior-tui.next-tag.name", data);
|
||||
match tag_name {
|
||||
None => "next".to_string(),
|
||||
Some(tag_name) => format!("{}", tag_name),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue