add filtering for given word
This commit is contained in:
parent
91c9ad7004
commit
d8ead6eabf
22
README.md
22
README.md
|
@ -14,7 +14,8 @@ kanbans and some script parameters.
|
|||
|
||||
In addition, it will display as "doing" each list item of the
|
||||
pattern `- ...(MM-DD)...` where `MM-DD` corresponds to the
|
||||
current month and day.
|
||||
current month and day,
|
||||
and it can also filter for cards containing a filter keyword.
|
||||
|
||||
## Installation
|
||||
|
||||
|
@ -46,15 +47,17 @@ then also the configuration can be displayed by entering `c`.
|
|||
- `w` : display all "waiting/backlog" entries as selection list
|
||||
- `do` N : change card to "doing/active" status
|
||||
- `done` N : change card to "archive/done" status
|
||||
and append a timestamp of format "// YY-MM-DD"
|
||||
and append a timestamp of format "// YY-MM-DD"
|
||||
- `wait` N : change card to "waiting/backlog" status
|
||||
- `n` : add a new item/card to the target kanban (only one line of text);
|
||||
content may be given on the same line, separated by whitespace
|
||||
content may be given on the same line, separated by whitespace
|
||||
- `k` : define target kanban file (for direct edition, and new items)
|
||||
- `f` F : define filter word F as grep pattern for selection of cards
|
||||
(empty is changed into `.` which matches all non-empty cards)
|
||||
- `ek` : directly edit the target kanban file with the text editor
|
||||
- `ec` : directly edit the configuration file with the text editor
|
||||
- `!` : execute arguments with shell, `/bin/sh -c` by default
|
||||
(set `myshell` variable in source to `echo` to deactivate this)
|
||||
(set `myshell` variable in source to `echo` to deactivate this)
|
||||
|
||||
In the list above, "N" is a number from the last displayed selection list;
|
||||
if none is given, the script asks for one. The numbers are not attributed
|
||||
|
@ -64,6 +67,13 @@ and it depends on the selection context, which one is referred to).
|
|||
The commands `do/done/wait` also accept several number arguments
|
||||
separated by white space.
|
||||
|
||||
"F" is a word used for filtering for specific cards. If the filter word is
|
||||
non-empty, only cards containing this word are displayed. Can be used e.g
|
||||
to only select cards containing a given "topic". Please note: this filter
|
||||
word actually is used as a grep string; dots will match any character and
|
||||
therefore should not be used in "topics" (leading `+` signs and `-_:,`
|
||||
anywhere are fine, though).
|
||||
|
||||
Be careful with the `ek` and the `ec` commands, as the syntax of the
|
||||
corresponding files must be preserved for the script to correctly work.
|
||||
Whitespace in general is no problem, though.
|
||||
|
@ -227,7 +237,7 @@ Just hitting RETURN at the prompt shows the help/usage page:
|
|||
|
||||
|<
|
||||
./clikan.sh : command line kanban
|
||||
(2020-02-10/HB9KNS)
|
||||
(2020-05-11/HB9KNS)
|
||||
configuration file: /home/username/.clikanconf
|
||||
for help about commands, just hit RETURN
|
||||
to show configuration, enter 'c'
|
||||
|
@ -269,4 +279,4 @@ by manually removing the entries marked with a `+` flag through the
|
|||
|
||||
---
|
||||
|
||||
*2020-02-10/HB9KNS,Y.Bonetti*
|
||||
*2020-05-11/HB9KNS,Y.Bonetti*
|
||||
|
|
17
clikan.sh
17
clikan.sh
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
# clikan.sh -- CLI Kanban
|
||||
ver='2020-04-23/HB9KNS'
|
||||
ver='2020-05-11/HB9KNS'
|
||||
|
||||
conf="${CLIKANCONF:-$HOME/.clikanconf}"
|
||||
defkanban="$HOME/clikanban.md"
|
||||
|
@ -8,6 +8,7 @@ editor="${CLIKANEDIT:-$VISUAL}"
|
|||
editor="${editor:-$EDITOR}"
|
||||
editor="${editor:-ed}"
|
||||
myshell='/bin/sh -c'
|
||||
filtr='.'
|
||||
|
||||
tmpf=`mktemp -t clikanXXXXXX` || tmpf=${TMPDIR:-/tmp}/clikan$$`date +%S%M%d`
|
||||
: >$tmpf
|
||||
|
@ -126,14 +127,17 @@ showall(){
|
|||
esac
|
||||
echo
|
||||
echo " $1 // `date`"
|
||||
if test "$filtr" != "."
|
||||
then echo " /$filtr/"
|
||||
fi
|
||||
if test "$f" = "*"
|
||||
then t=`date +%m-%d`
|
||||
# for "doing", sort cards
|
||||
cat $kbs | getlines "$f" | condsort
|
||||
# for "doing", sort filtered cards
|
||||
grep -i "$filtr" $kbs | getlines "$f" | condsort
|
||||
# and also display '- ...(MM-DD)...' calendar entries
|
||||
cat $kbs | grep "^[*+-] .*($t)" | sed -e 's/^. //'
|
||||
# for waiting and archive, keep saved card order
|
||||
else cat $kbs | getlines "$f"
|
||||
# for waiting and archive, filter but keep saved card order
|
||||
else grep -i "$filtr" $kbs | getlines "$f"
|
||||
# for all cases, select the cards and show the beginning of the list
|
||||
fi | showselect "$f " | head -n $ms
|
||||
}
|
||||
|
@ -185,6 +189,7 @@ command keys:
|
|||
wait N: put card N back to waiting/todo state
|
||||
do N: put card N into doing state
|
||||
note: done/wait/do accept several arguments separated by white space
|
||||
f F: filter cards for grep pattern F (empty='.')
|
||||
ec: directly edit config file -- DANGER!
|
||||
ek: directly edit kanban file -- DANGER!
|
||||
!: execute arguments with "$myshell"
|
||||
|
@ -250,6 +255,8 @@ ec) echo calling "$editor $conf" ...
|
|||
echo please quit and restart to reload config ;;
|
||||
ek) echo calling "$editor $currkan" ...
|
||||
"$editor" "$currkan" ;;
|
||||
f) filtr="${coa1:-.}"
|
||||
echo "filtering for grep pattern '$filtr'" ;;
|
||||
!*) echo
|
||||
$myshell "${com#!} $coa1 $coa2 $coa3 $coar"
|
||||
echo ;;
|
||||
|
|
Loading…
Reference in New Issue