Selaa lähdekoodia

Deal with several ShellCheck warnings

Work around, obey, or disable.
Alois Mahdal 5 vuotta sitten
vanhempi
commit
5be271d311
1 muutettua tiedostoa jossa 15 lisäystä ja 8 poistoa
  1. 15
    8
      dotfiles/bash/main.bashrc

+ 15
- 8
dotfiles/bash/main.bashrc Näytä tiedosto

1
 #!/bin/bash
1
 #!/bin/bash
2
-#shellcheck disable=SC1091
3
 
2
 
4
 ## hack to workaround Fedora/Red Hat bug 878428
3
 ## hack to workaround Fedora/Red Hat bug 878428
4
+#shellcheck disable=SC1091
5
 test -f /usr/share/git-core/contrib/completion/git-prompt.sh \
5
 test -f /usr/share/git-core/contrib/completion/git-prompt.sh \
6
  && . /usr/share/git-core/contrib/completion/git-prompt.sh
6
  && . /usr/share/git-core/contrib/completion/git-prompt.sh
7
 
7
 
147
     #
147
     #
148
     # Deep in git repo, cd to the git root
148
     # Deep in git repo, cd to the git root
149
     #
149
     #
150
-    cd "$(git rev-parse --show-toplevel)"
150
+    cd "$(git rev-parse --show-toplevel)" || return 1
151
 }
151
 }
152
 
152
 
153
 clsz() {
153
 clsz() {
171
     #
171
     #
172
     # Stolen from http://unix.stackexchange.com/a/4533/9365
172
     # Stolen from http://unix.stackexchange.com/a/4533/9365
173
     #
173
     #
174
-    sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
174
+    sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g'
175
 }
175
 }
176
 
176
 
177
 vims() {
177
 vims() {
200
     # disaster.
200
     # disaster.
201
     #
201
     #
202
     local swap="$HOME/.local/share/vim/swap"
202
     local swap="$HOME/.local/share/vim/swap"
203
+    #shellcheck disable=SC1117
203
     find "$swap" -type f -print0 \
204
     find "$swap" -type f -print0 \
204
       | xargs -0 -r stat -c "%y %n" \
205
       | xargs -0 -r stat -c "%y %n" \
205
       | sed "
206
       | sed "
346
     #     rm useful_name.txt
347
     #     rm useful_name.txt
347
     #
348
     #
348
     local name="${1:-clipboard_dump.txt}"
349
     local name="${1:-clipboard_dump.txt}"
349
-    local tmp=$(mktemp -d -t "xod.XXXXXXXX")
350
+    local tmp
351
+    tmp=$(mktemp -d -t "xod.XXXXXXXX")
350
     xclip -o > "$tmp/$name"
352
     xclip -o > "$tmp/$name"
351
     echo "$tmp/$name"
353
     echo "$tmp/$name"
352
 }
354
 }
356
     # Just like xod() but using xoo (i.e. 'clipboard' clipboard)
358
     # Just like xod() but using xoo (i.e. 'clipboard' clipboard)
357
     #
359
     #
358
     local name="${1:-clipboard_dump.txt}"
360
     local name="${1:-clipboard_dump.txt}"
359
-    local tmp=$(mktemp -d -t "xood.XXXXXXXX")
361
+    local tmp
362
+    tmp=$(mktemp -d -t "xood.XXXXXXXX")
360
     xclip -selection clipboard -o > "$tmp/$name"
363
     xclip -selection clipboard -o > "$tmp/$name"
361
     echo "$tmp/$name"
364
     echo "$tmp/$name"
362
 }
365
 }
502
 export PRETTY=color
505
 export PRETTY=color
503
 export PRETTY_DEBUG_EXCLUDE=inigrep
506
 export PRETTY_DEBUG_EXCLUDE=inigrep
504
 
507
 
505
-GIT_PS1_SHOWDIRTYSTATE=true
506
-GIT_PS1_SHOWUNTRACKEDFILES=true
507
-GIT_DISABLED_COMMANDS="$HOME/.gittum/disabled-commands"
508
+#shellcheck disable=SC2034
509
+{
510
+    GIT_PS1_SHOWDIRTYSTATE=true
511
+    GIT_PS1_SHOWUNTRACKEDFILES=true
512
+    __SATURNIN_COMPLETE_DEBUG=true
513
+    GIT_DISABLED_COMMANDS="$HOME/.gittum/disabled-commands"
514
+}
508
 export GIT_PAGER='less -S'
515
 export GIT_PAGER='less -S'
509
 
516
 
510
 # disable mounting things like SFTP to ~/.gvfs when accessed
517
 # disable mounting things like SFTP to ~/.gvfs when accessed