From bd4a581f3e429e3c1b6838bfeeb35982f9f86ddd Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Thu, 18 Aug 2022 17:29:24 +0300 Subject: [PATCH 1/2] cli/show: improve error messages --- src/cli/show.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cli/show.rs b/src/cli/show.rs index 9d4c06a..ca20359 100644 --- a/src/cli/show.rs +++ b/src/cli/show.rs @@ -58,10 +58,10 @@ pub fn execute(repo: impl Repository, args: Args) { Err(idx_err) => match first.parse::() { Ok(part) => (None, Some(part)), Err(part_err) => { - return eprint!( - r#"error: Invalid value "{}": {}; {}"#, - first, idx_err, part_err - ) + eprintln!("error: Invalid value {first:?}:"); + eprintln!("- {idx_err}"); + eprintln!("- {part_err}"); + return; } }, } @@ -73,16 +73,16 @@ pub fn execute(repo: impl Repository, args: Args) { let idx = match first.parse::() { Ok(idx) => Some(idx), - Err(err) => return eprint!(r#"error: Invalid value "{}": {}"#, first, err), + Err(err) => return eprintln!("error: Invalid value {first:?}: {err}"), }; let part = match second.parse::() { Ok(part) => Some(part), - Err(err) => return eprint!(r#"error: Invalid value "{}": {}"#, second, err), + Err(err) => return eprintln!("error: Invalid value {second:?}: {err}"), }; (idx, part) } - _ => return eprintln!("error: To much arguments: {}", args.rest.join(",")), + _ => return eprintln!("error: To much arguments: {:?}", args.rest), }; let task = if let Some(idx) = idx { -- 2.46.1 From f7c3d2c040f7735f3a35b9ba10d8bd14315946f8 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Fri, 19 Aug 2022 16:39:33 +0300 Subject: [PATCH 2/2] shell/zsh: add basic integration with fzf Closes #29 --- shell/zsh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 shell/zsh diff --git a/shell/zsh b/shell/zsh new file mode 100644 index 0000000..115c592 --- /dev/null +++ b/shell/zsh @@ -0,0 +1,32 @@ +function __tas_task_idx() { + echo "$@" | sed 's/^\([0-9]\+\)\..\+$/\1/' +} + +function __tas_show() { + tas show $(__tas_task_idx "$@") +} + +function __tas_start() { + tas start $(__tas_task_idx "$@") +} + +function __tas_list() { + tas list | fzf --info=inline --height=50% --no-sort --keep-right --layout=reverse +} + +function taz() { + case $1 in + "" | "show" | "sh") + __tas_show $(__tas_list) + ;; + + "list" | "ls") + __tas_list + ;; + + "start" | "st") + __tas_start $(__tas_list) + + esac +} + -- 2.46.1