Преглед на файлове

Improve variable declaration style

Separate declaration from initialization and add variable comments.
Alois Mahdal преди 8 години
родител
ревизия
50799560b6
променени са 1 файла, в които са добавени 8 реда и са изтрити 4 реда
  1. 8
    4
      dotfiles/bash/post.bashrc

+ 8
- 4
dotfiles/bash/post.bashrc Целия файл

@@ -5,9 +5,12 @@
5 5
 ######################################################
6 6
 
7 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 14
     test "$1" == "-r" && do_rm=true
12 15
     if [ "0$lastrv" -gt 0 ];
13 16
     then
@@ -24,7 +27,8 @@ __bashum__save_rv() {
24 27
 }
25 28
 
26 29
 __bashum__task_context() {
27
-    local ctx=$(task _get rc.context)
30
+    local ctx       # TaskWarrior context
31
+    ctx=$(task _get rc.context)
28 32
     test -n "$ctx" || return
29 33
     echo -n "|$ctx"
30 34
 }