diff options
Diffstat (limited to '.bashrc')
-rw-r--r-- | .bashrc | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -272,7 +272,6 @@ function ca() { # ca = create action var="$GTD_DIR$1.txt" touch "$var" - echo "$2" if [ "x$2" != "x" ]; then echo "$2" >"$var" fi @@ -383,6 +382,16 @@ function da(){ fi } +function pa() { + # pa = print action + # pull a list of tasks with an optional search term + # then cat the contents of the file + SEL=$(rg --max-depth=1 -l $1 $GTD_DIR -g '!proj*'| cut -c 21- | fzf -e -i --bind 'tab:up') + #trickery to add to beginning of the file + content="$GTD_DIR$SEL" + cat "$content" +} + ## Project functions function pc(){ # pc = project create @@ -391,6 +400,9 @@ function pc(){ if [ "x$2" != "x" ]; then echo "$2" >"$proj" fi + if [ "x$3" != "x" ]; then + echo "$3" >>"$proj" + fi } function pl(){ # pl = project list @@ -398,13 +410,13 @@ function pl(){ if [ $# -eq 0 ]; then echo '----------- all projects ----------' echo ' ' - rg --files $GTD_DIR | rg -w proj* | cut -c 26- | rev | cut -c 5- | rev + rg --files $GTD_DIR --line-number --sort path | rg -w proj* | cut -c 26- | rev | cut -c 5- | rev | nl echo ' ' echo '-----------------------------------' else echo "--------- all $1 projects ----------" echo ' ' - rg $1 $GTD_DIR | rg -w proj* | cut -c 26- | rev | cut -c 12- | rev + rg $1 $GTD_DIR | rg -w proj* --line-number --sort path | cut -c 26- | rev | cut -c 12- | rev | nl echo ' ' echo '---------------------------------------' fi |