Browse Source

Improve variable declaration style

Separate declaration from initialization and add variable comments.
Alois Mahdal 8 years ago
parent
commit
50799560b6
1 changed files with 8 additions and 4 deletions
  1. 8
    4
      dotfiles/bash/post.bashrc

+ 8
- 4
dotfiles/bash/post.bashrc View File

5
 ######################################################
5
 ######################################################
6
 
6
 
7
 __bashum__lastrv() {
7
 __bashum__lastrv() {
8
-    local rvfile="$RV_TMP/$$.lastrv"
9
-    local lastrv="$(cat "$rvfile")"
10
-    local do_rm=false
8
+    local rvfile        # path to return value cache file
9
+    local lastrv        # actual last return value
10
+    local do_rm         # true if we should remove the cache
11
+    rvfile="$RV_TMP/$$.lastrv"
12
+    lastrv="$(cat "$rvfile")"
13
+    do_rm=false
11
     test "$1" == "-r" && do_rm=true
14
     test "$1" == "-r" && do_rm=true
12
     if [ "0$lastrv" -gt 0 ];
15
     if [ "0$lastrv" -gt 0 ];
13
     then
16
     then
24
 }
27
 }
25
 
28
 
26
 __bashum__task_context() {
29
 __bashum__task_context() {
27
-    local ctx=$(task _get rc.context)
30
+    local ctx       # TaskWarrior context
31
+    ctx=$(task _get rc.context)
28
     test -n "$ctx" || return
32
     test -n "$ctx" || return
29
     echo -n "|$ctx"
33
     echo -n "|$ctx"
30
 }
34
 }