mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-25 17:57:19 +02:00
Merge pull request #173 from kdheepak/fix-ci
This commit is contained in:
commit
7826c300df
5 changed files with 47 additions and 172 deletions
2
.github/workflows/cd.yml
vendored
2
.github/workflows/cd.yml
vendored
|
@ -277,7 +277,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
TASKRC: taskwarrior-testdata/.taskrc
|
TASKRC: taskwarrior-testdata/.taskrc
|
||||||
TASKDATA: taskwarrior-testdata/.task
|
TASKDATA: taskwarrior-testdata/.task
|
||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: full
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Install toolchain
|
- name: Install toolchain
|
||||||
|
|
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -23,7 +23,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
TASKRC: taskwarrior-testdata/.taskrc
|
TASKRC: taskwarrior-testdata/.taskrc
|
||||||
TASKDATA: taskwarrior-testdata/.task
|
TASKDATA: taskwarrior-testdata/.task
|
||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: full
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: actions-rs/toolchain@v1
|
||||||
|
@ -36,6 +36,8 @@ jobs:
|
||||||
with:
|
with:
|
||||||
repository: kdheepak/taskwarrior-testdata
|
repository: kdheepak/taskwarrior-testdata
|
||||||
path: taskwarrior-testdata
|
path: taskwarrior-testdata
|
||||||
|
- run: |
|
||||||
|
ulimit -a
|
||||||
- run: |
|
- run: |
|
||||||
# prepare taskwarrior, initial setup
|
# prepare taskwarrior, initial setup
|
||||||
task rc.confirmation=off || echo 0
|
task rc.confirmation=off || echo 0
|
||||||
|
|
21
src/app.rs
21
src/app.rs
|
@ -219,7 +219,8 @@ impl TaskwarriorTuiApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
let data = String::from_utf8_lossy(&output.stdout);
|
let data = String::from_utf8_lossy(&output.stdout);
|
||||||
let (c, kc) = task::block_on(async { try_join!(Config::new(&data), KeyConfig::new(&data)) })?;
|
let c = Config::new(&data)?;
|
||||||
|
let kc = KeyConfig::new(&data)?;
|
||||||
|
|
||||||
let (w, h) = crossterm::terminal::size()?;
|
let (w, h) = crossterm::terminal::size()?;
|
||||||
|
|
||||||
|
@ -2354,18 +2355,10 @@ mod tests {
|
||||||
std::fs::remove_dir_all(cd).unwrap();
|
std::fs::remove_dir_all(cd).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_taskwarrior_timing() {
|
|
||||||
let app = TaskwarriorTuiApp::new();
|
|
||||||
if app.is_err() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_taskwarrior_tui() {
|
fn test_taskwarrior_tui() {
|
||||||
let app = TaskwarriorTuiApp::new();
|
let app = TaskwarriorTuiApp::new();
|
||||||
if app.is_err() {
|
if let Err(_) = app {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let app = app.unwrap();
|
let app = app.unwrap();
|
||||||
|
@ -3143,23 +3136,23 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in 3..=22 {
|
for i in 3..=22 {
|
||||||
expected.get_mut(i, 4).set_style(Style::default().bg(Color::Black));
|
expected.get_mut(i, 4).set_style(Style::default().bg(Color::Reset));
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in 25..=44 {
|
for i in 25..=44 {
|
||||||
expected.get_mut(i, 4).set_style(Style::default().bg(Color::Black));
|
expected.get_mut(i, 4).set_style(Style::default().bg(Color::Reset));
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in 3..=22 {
|
for i in 3..=22 {
|
||||||
expected
|
expected
|
||||||
.get_mut(i, 5)
|
.get_mut(i, 5)
|
||||||
.set_style(Style::default().bg(Color::Black).add_modifier(Modifier::UNDERLINED));
|
.set_style(Style::default().bg(Color::Reset).add_modifier(Modifier::UNDERLINED));
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in 25..=44 {
|
for i in 25..=44 {
|
||||||
expected
|
expected
|
||||||
.get_mut(i, 5)
|
.get_mut(i, 5)
|
||||||
.set_style(Style::default().bg(Color::Black).add_modifier(Modifier::UNDERLINED));
|
.set_style(Style::default().bg(Color::Reset).add_modifier(Modifier::UNDERLINED));
|
||||||
}
|
}
|
||||||
|
|
||||||
test_case(&expected);
|
test_case(&expected);
|
||||||
|
|
127
src/config.rs
127
src/config.rs
|
@ -1,7 +1,5 @@
|
||||||
|
#![allow(clippy::eval_order_dependence)]
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use async_std::process::Command;
|
|
||||||
use async_std::task;
|
|
||||||
use futures::join;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
@ -64,7 +62,7 @@ pub struct Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub async fn new(data: &str) -> Result<Self> {
|
pub fn new(data: &str) -> Result<Self> {
|
||||||
let bool_collection = Self::get_bool_collection();
|
let bool_collection = Self::get_bool_collection();
|
||||||
|
|
||||||
let enabled = true;
|
let enabled = true;
|
||||||
|
@ -93,53 +91,6 @@ impl Config {
|
||||||
let uda_style_context_active = Self::get_uda_style("context.active", data);
|
let uda_style_context_active = Self::get_uda_style("context.active", data);
|
||||||
let uda_shortcuts = Self::get_uda_shortcuts(data);
|
let uda_shortcuts = Self::get_uda_shortcuts(data);
|
||||||
|
|
||||||
let (
|
|
||||||
color,
|
|
||||||
filter,
|
|
||||||
data_location,
|
|
||||||
due,
|
|
||||||
rule_precedence_color,
|
|
||||||
uda_tick_rate,
|
|
||||||
uda_prefill_task_metadata,
|
|
||||||
uda_task_detail_prefetch,
|
|
||||||
uda_task_report_show_info,
|
|
||||||
uda_task_report_looping,
|
|
||||||
uda_selection_indicator,
|
|
||||||
uda_mark_indicator,
|
|
||||||
uda_unmark_indicator,
|
|
||||||
uda_selection_bold,
|
|
||||||
uda_selection_italic,
|
|
||||||
uda_selection_dim,
|
|
||||||
uda_selection_blink,
|
|
||||||
uda_calendar_months_per_row,
|
|
||||||
uda_style_calendar_title,
|
|
||||||
uda_style_context_active,
|
|
||||||
uda_shortcuts,
|
|
||||||
) = join!(
|
|
||||||
color,
|
|
||||||
filter,
|
|
||||||
data_location,
|
|
||||||
due,
|
|
||||||
rule_precedence_color,
|
|
||||||
uda_tick_rate,
|
|
||||||
uda_prefill_task_metadata,
|
|
||||||
uda_task_detail_prefetch,
|
|
||||||
uda_task_report_show_info,
|
|
||||||
uda_task_report_looping,
|
|
||||||
uda_selection_indicator,
|
|
||||||
uda_mark_indicator,
|
|
||||||
uda_unmark_indicator,
|
|
||||||
uda_selection_bold,
|
|
||||||
uda_selection_italic,
|
|
||||||
uda_selection_dim,
|
|
||||||
uda_selection_blink,
|
|
||||||
uda_calendar_months_per_row,
|
|
||||||
uda_style_calendar_title,
|
|
||||||
uda_style_context_active,
|
|
||||||
uda_shortcuts,
|
|
||||||
);
|
|
||||||
|
|
||||||
let color = color?;
|
|
||||||
let uda_style_calendar_title = uda_style_calendar_title.unwrap_or_default();
|
let uda_style_calendar_title = uda_style_calendar_title.unwrap_or_default();
|
||||||
let uda_style_context_active = uda_style_context_active.unwrap_or_default();
|
let uda_style_context_active = uda_style_context_active.unwrap_or_default();
|
||||||
|
|
||||||
|
@ -175,23 +126,23 @@ impl Config {
|
||||||
HashMap::new()
|
HashMap::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_uda_shortcuts(data: &str) -> Vec<String> {
|
fn get_uda_shortcuts(data: &str) -> Vec<String> {
|
||||||
let mut v = vec![];
|
let mut v = vec![];
|
||||||
for s in 0..=9 {
|
for s in 0..=9 {
|
||||||
let c = format!("uda.taskwarrior-tui.shortcuts.{}", s);
|
let c = format!("uda.taskwarrior-tui.shortcuts.{}", s);
|
||||||
let s = Self::get_config(&c, data).await.unwrap_or_default();
|
let s = Self::get_config(&c, data).unwrap_or_default();
|
||||||
v.push(s);
|
v.push(s);
|
||||||
}
|
}
|
||||||
v
|
v
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_uda_style(config: &str, data: &str) -> Option<Style> {
|
fn get_uda_style(config: &str, data: &str) -> Option<Style> {
|
||||||
let c = format!("uda.taskwarrior-tui.style.{}", config);
|
let c = format!("uda.taskwarrior-tui.style.{}", config);
|
||||||
let s = Self::get_config(&c, data).await?;
|
let s = Self::get_config(&c, data)?;
|
||||||
Some(Self::get_tcolor(&s))
|
Some(Self::get_tcolor(&s))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_color_collection(data: &str) -> Result<HashMap<String, Style>> {
|
fn get_color_collection(data: &str) -> HashMap<String, Style> {
|
||||||
let mut color_collection = HashMap::new();
|
let mut color_collection = HashMap::new();
|
||||||
for line in data.split('\n') {
|
for line in data.split('\n') {
|
||||||
if line.starts_with("color.") {
|
if line.starts_with("color.") {
|
||||||
|
@ -200,14 +151,12 @@ impl Config {
|
||||||
let line = i.collect::<Vec<_>>().join(" ");
|
let line = i.collect::<Vec<_>>().join(" ");
|
||||||
let line = line.trim_start_matches(' ');
|
let line = line.trim_start_matches(' ');
|
||||||
let tcolor = Self::get_tcolor(&line);
|
let tcolor = Self::get_tcolor(&line);
|
||||||
match attribute {
|
if let Some(attr) = attribute {
|
||||||
Some(attr) => color_collection.insert(attr.to_string(), tcolor),
|
color_collection.insert(attr.to_string(), tcolor);
|
||||||
None => None,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
color_collection
|
||||||
Ok(color_collection)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_tcolor(line: &str) -> Style {
|
pub fn get_tcolor(line: &str) -> Style {
|
||||||
|
@ -356,7 +305,7 @@ impl Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_config(config: &str, data: &str) -> Option<String> {
|
fn get_config(config: &str, data: &str) -> Option<String> {
|
||||||
for line in data.split('\n') {
|
for line in data.split('\n') {
|
||||||
if line.starts_with(config) {
|
if line.starts_with(config) {
|
||||||
return Some(line.trim_start_matches(config).trim_start().trim_end().to_string());
|
return Some(line.trim_start_matches(config).trim_start().trim_end().to_string());
|
||||||
|
@ -369,136 +318,122 @@ impl Config {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_due(data: &str) -> usize {
|
fn get_due(data: &str) -> usize {
|
||||||
Self::get_config("due", data)
|
Self::get_config("due", data)
|
||||||
.await
|
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.parse::<usize>()
|
.parse::<usize>()
|
||||||
.unwrap_or(7)
|
.unwrap_or(7)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_rule_precedence_color(data: &str) -> Vec<String> {
|
fn get_rule_precedence_color(data: &str) -> Vec<String> {
|
||||||
let data = Self::get_config("rule.precedence.color", data)
|
let data = Self::get_config("rule.precedence.color", data)
|
||||||
.await
|
|
||||||
.context("Unable to parse `task show rule.precedence.color`.")
|
.context("Unable to parse `task show rule.precedence.color`.")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
data.split(',').map(|s| s.to_string()).collect::<Vec<_>>()
|
data.split(',').map(|s| s.to_string()).collect::<Vec<_>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_filter(data: &str) -> String {
|
fn get_filter(data: &str) -> String {
|
||||||
let filter = Self::get_config("report.next.filter", data)
|
let filter = Self::get_config("report.next.filter", data)
|
||||||
.await
|
|
||||||
.context("Unable to parse `task show report.next.filter`.")
|
.context("Unable to parse `task show report.next.filter`.")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
format!("{} ", filter)
|
format!("{} ", filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_data_location(data: &str) -> String {
|
fn get_data_location(data: &str) -> String {
|
||||||
Self::get_config("data.location", data)
|
Self::get_config("data.location", data)
|
||||||
.await
|
|
||||||
.context("Unable to parse `task show data.location`.")
|
.context("Unable to parse `task show data.location`.")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_uda_prefill_task_metadata(data: &str) -> bool {
|
fn get_uda_prefill_task_metadata(data: &str) -> bool {
|
||||||
Self::get_config("uda.taskwarrior-tui.task-report.pre-fill-task-meta-data", data)
|
Self::get_config("uda.taskwarrior-tui.task-report.pre-fill-task-meta-data", data)
|
||||||
.await
|
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.get_bool()
|
.get_bool()
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_uda_tick_rate(data: &str) -> u64 {
|
fn get_uda_tick_rate(data: &str) -> u64 {
|
||||||
Self::get_config("uda.taskwarrior-tui.tick-rate", data)
|
Self::get_config("uda.taskwarrior-tui.tick-rate", data)
|
||||||
.await
|
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.parse::<u64>()
|
.parse::<u64>()
|
||||||
.unwrap_or(250)
|
.unwrap_or(250)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_uda_task_detail_prefetch(data: &str) -> usize {
|
fn get_uda_task_detail_prefetch(data: &str) -> usize {
|
||||||
Self::get_config("uda.taskwarrior-tui.task-report.task-detail-prefetch", data)
|
Self::get_config("uda.taskwarrior-tui.task-report.task-detail-prefetch", data)
|
||||||
.await
|
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.parse::<usize>()
|
.parse::<usize>()
|
||||||
.unwrap_or(10)
|
.unwrap_or(10)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_uda_task_report_show_info(data: &str) -> bool {
|
fn get_uda_task_report_show_info(data: &str) -> bool {
|
||||||
Self::get_config("uda.taskwarrior-tui.task-report.show-info", data)
|
Self::get_config("uda.taskwarrior-tui.task-report.show-info", data)
|
||||||
.await
|
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.get_bool()
|
.get_bool()
|
||||||
.unwrap_or(true)
|
.unwrap_or(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_uda_task_report_looping(data: &str) -> bool {
|
fn get_uda_task_report_looping(data: &str) -> bool {
|
||||||
Self::get_config("uda.taskwarrior-tui.task-report.looping", data)
|
Self::get_config("uda.taskwarrior-tui.task-report.looping", data)
|
||||||
.await
|
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.get_bool()
|
.get_bool()
|
||||||
.unwrap_or(true)
|
.unwrap_or(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_uda_selection_indicator(data: &str) -> String {
|
fn get_uda_selection_indicator(data: &str) -> String {
|
||||||
let indicator = Self::get_config("uda.taskwarrior-tui.selection.indicator", data).await;
|
let indicator = Self::get_config("uda.taskwarrior-tui.selection.indicator", data);
|
||||||
match indicator {
|
match indicator {
|
||||||
None => "• ".to_string(),
|
None => "• ".to_string(),
|
||||||
Some(indicator) => format!("{} ", indicator),
|
Some(indicator) => format!("{} ", indicator),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_uda_mark_indicator(data: &str) -> String {
|
fn get_uda_mark_indicator(data: &str) -> String {
|
||||||
let indicator = Self::get_config("uda.taskwarrior-tui.mark.indicator", data).await;
|
let indicator = Self::get_config("uda.taskwarrior-tui.mark.indicator", data);
|
||||||
match indicator {
|
match indicator {
|
||||||
None => "✔ ".to_string(),
|
None => "✔ ".to_string(),
|
||||||
Some(indicator) => format!("{} ", indicator),
|
Some(indicator) => format!("{} ", indicator),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_uda_unmark_indicator(data: &str) -> String {
|
fn get_uda_unmark_indicator(data: &str) -> String {
|
||||||
let indicator = Self::get_config("uda.taskwarrior-tui.unmark.indicator", data).await;
|
let indicator = Self::get_config("uda.taskwarrior-tui.unmark.indicator", data);
|
||||||
match indicator {
|
match indicator {
|
||||||
None => " ".to_string(),
|
None => " ".to_string(),
|
||||||
Some(indicator) => format!("{} ", indicator),
|
Some(indicator) => format!("{} ", indicator),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_uda_selection_bold(data: &str) -> bool {
|
fn get_uda_selection_bold(data: &str) -> bool {
|
||||||
Self::get_config("uda.taskwarrior-tui.selection.bold", data)
|
Self::get_config("uda.taskwarrior-tui.selection.bold", data)
|
||||||
.await
|
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.get_bool()
|
.get_bool()
|
||||||
.unwrap_or(true)
|
.unwrap_or(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_uda_selection_italic(data: &str) -> bool {
|
fn get_uda_selection_italic(data: &str) -> bool {
|
||||||
Self::get_config("uda.taskwarrior-tui.selection.italic", data)
|
Self::get_config("uda.taskwarrior-tui.selection.italic", data)
|
||||||
.await
|
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.get_bool()
|
.get_bool()
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_uda_selection_dim(data: &str) -> bool {
|
fn get_uda_selection_dim(data: &str) -> bool {
|
||||||
Self::get_config("uda.taskwarrior-tui.selection.dim", data)
|
Self::get_config("uda.taskwarrior-tui.selection.dim", data)
|
||||||
.await
|
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.get_bool()
|
.get_bool()
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_uda_selection_blink(data: &str) -> bool {
|
fn get_uda_selection_blink(data: &str) -> bool {
|
||||||
Self::get_config("uda.taskwarrior-tui.selection.blink", data)
|
Self::get_config("uda.taskwarrior-tui.selection.blink", data)
|
||||||
.await
|
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.get_bool()
|
.get_bool()
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_uda_months_per_row(data: &str) -> usize {
|
fn get_uda_months_per_row(data: &str) -> usize {
|
||||||
Self::get_config("uda.taskwarrior-tui.calendar.months-per-row", data)
|
Self::get_config("uda.taskwarrior-tui.calendar.months-per-row", data)
|
||||||
.await
|
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.parse::<usize>()
|
.parse::<usize>()
|
||||||
.unwrap_or(4)
|
.unwrap_or(4)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
|
#![allow(clippy::eval_order_dependence)]
|
||||||
use crate::util::Key;
|
use crate::util::Key;
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use async_std::process::Command;
|
|
||||||
use async_std::task;
|
|
||||||
use futures::join;
|
use futures::join;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
@ -92,13 +91,13 @@ impl Default for KeyConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl KeyConfig {
|
impl KeyConfig {
|
||||||
pub async fn new(data: &str) -> Result<Self> {
|
pub fn new(data: &str) -> Result<Self> {
|
||||||
let mut kc = Self::default();
|
let mut kc = Self::default();
|
||||||
kc.update(data).await?;
|
kc.update(data)?;
|
||||||
Ok(kc)
|
Ok(kc)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn update(&mut self, data: &str) -> Result<()> {
|
pub fn update(&mut self, data: &str) -> Result<()> {
|
||||||
let quit = self.get_config("uda.taskwarrior-tui.keyconfig.quit", data);
|
let quit = self.get_config("uda.taskwarrior-tui.keyconfig.quit", data);
|
||||||
let refresh = self.get_config("uda.taskwarrior-tui.keyconfig.refresh", data);
|
let refresh = self.get_config("uda.taskwarrior-tui.keyconfig.refresh", data);
|
||||||
let go_to_bottom = self.get_config("uda.taskwarrior-tui.keyconfig.go-to-bottom", data);
|
let go_to_bottom = self.get_config("uda.taskwarrior-tui.keyconfig.go-to-bottom", data);
|
||||||
|
@ -125,60 +124,6 @@ impl KeyConfig {
|
||||||
let next_tab = self.get_config("uda.taskwarrior-tui.keyconfig.next-tab", data);
|
let next_tab = self.get_config("uda.taskwarrior-tui.keyconfig.next-tab", data);
|
||||||
let previous_tab = self.get_config("uda.taskwarrior-tui.keyconfig.previous-tab", data);
|
let previous_tab = self.get_config("uda.taskwarrior-tui.keyconfig.previous-tab", data);
|
||||||
|
|
||||||
let (
|
|
||||||
quit,
|
|
||||||
refresh,
|
|
||||||
go_to_bottom,
|
|
||||||
go_to_top,
|
|
||||||
down,
|
|
||||||
up,
|
|
||||||
page_down,
|
|
||||||
page_up,
|
|
||||||
delete,
|
|
||||||
done,
|
|
||||||
start_stop,
|
|
||||||
select,
|
|
||||||
select_all,
|
|
||||||
undo,
|
|
||||||
edit,
|
|
||||||
modify,
|
|
||||||
shell,
|
|
||||||
log,
|
|
||||||
add,
|
|
||||||
annotate,
|
|
||||||
filter,
|
|
||||||
zoom,
|
|
||||||
context_menu,
|
|
||||||
next_tab,
|
|
||||||
previous_tab,
|
|
||||||
) = join!(
|
|
||||||
quit,
|
|
||||||
refresh,
|
|
||||||
go_to_bottom,
|
|
||||||
go_to_top,
|
|
||||||
down,
|
|
||||||
up,
|
|
||||||
page_down,
|
|
||||||
page_up,
|
|
||||||
delete,
|
|
||||||
done,
|
|
||||||
start_stop,
|
|
||||||
select,
|
|
||||||
select_all,
|
|
||||||
undo,
|
|
||||||
edit,
|
|
||||||
modify,
|
|
||||||
shell,
|
|
||||||
log,
|
|
||||||
add,
|
|
||||||
annotate,
|
|
||||||
filter,
|
|
||||||
zoom,
|
|
||||||
context_menu,
|
|
||||||
next_tab,
|
|
||||||
previous_tab,
|
|
||||||
);
|
|
||||||
|
|
||||||
self.quit = quit.unwrap_or(self.quit);
|
self.quit = quit.unwrap_or(self.quit);
|
||||||
self.refresh = refresh.unwrap_or(self.refresh);
|
self.refresh = refresh.unwrap_or(self.refresh);
|
||||||
self.go_to_bottom = go_to_bottom.unwrap_or(self.go_to_bottom);
|
self.go_to_bottom = go_to_bottom.unwrap_or(self.go_to_bottom);
|
||||||
|
@ -246,7 +191,7 @@ impl KeyConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_config(&self, config: &str, data: &str) -> Option<Key> {
|
fn get_config(&self, config: &str, data: &str) -> Option<Key> {
|
||||||
for line in data.split('\n') {
|
for line in data.split('\n') {
|
||||||
if line.starts_with(config) {
|
if line.starts_with(config) {
|
||||||
let line = line.trim_start_matches(config).trim_start().trim_end().to_string();
|
let line = line.trim_start_matches(config).trim_start().trim_end().to_string();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue