summaryrefslogtreecommitdiffstats
path: root/tv/5pkgs/simple/q
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2017-09-20 11:58:04 +0200
committertv <tv@krebsco.de>2017-09-20 11:58:04 +0200
commit6fed88c5611f71726c82af93d0df0ac4112e9814 (patch)
tree35a38b9af5ec4926dd5e046b017b8c6e664d2415 /tv/5pkgs/simple/q
parent778ce898a2cc97176d26d001687403d2f7660f2a (diff)
tv q: print just no. of entries in ~ if PWD!=HOME
Diffstat (limited to 'tv/5pkgs/simple/q')
-rw-r--r--tv/5pkgs/simple/q/default.nix18
1 files changed, 11 insertions, 7 deletions
diff --git a/tv/5pkgs/simple/q/default.nix b/tv/5pkgs/simple/q/default.nix
index 2e7aa5cf2..655c75e1b 100644
--- a/tv/5pkgs/simple/q/default.nix
+++ b/tv/5pkgs/simple/q/default.nix
@@ -262,7 +262,7 @@ let
'';
q-todo = ''
- TODO_file=$HOME/TODO
+ TODO_file=$PWD/TODO
if test -e "$TODO_file"; then
${pkgs.coreutils}/bin/cat "$TODO_file" \
| ${pkgs.gawk}/bin/gawk -v now=$(${pkgs.coreutils}/bin/date +%s) '
@@ -294,13 +294,7 @@ in
pkgs.writeBashBin "q" ''
set -eu
export PATH=/var/empty
- (${q-todo}) || :
- if [ "$PWD" != "$HOME" ]; then
- (HOME=$PWD; ${q-todo}) || :
- fi
- echo
${q-cal}
- echo
${q-isodate}
${q-sgtdate}
(${q-gitdir}) &
@@ -311,4 +305,14 @@ pkgs.writeBashBin "q" ''
(${q-online}) &
(${q-thermal_zone}) &
wait
+ if test "$PWD" != "$HOME" && test -e "$HOME/TODO"; then
+ TODO_home_entries=$(cd; (${q-todo}) | ${pkgs.coreutils}/bin/wc -l)
+ if test "$TODO_home_entries" = 1; then
+ TODO_format='There is %d entry in ~/TODO'
+ else
+ TODO_format='There are %d entries in ~/TODO'
+ fi
+ printf "\x1b[38;5;238m$TODO_format\x1b[m\n" "$TODO_home_entries"
+ fi
+ (${q-todo}) || :
''