Browse Source

Deal with several ShellCheck warnings

Work around, obey, or disable.
Alois Mahdal 5 years ago
parent
commit
5be271d311
1 changed files with 15 additions and 8 deletions
  1. 15
    8
      dotfiles/bash/main.bashrc

+ 15
- 8
dotfiles/bash/main.bashrc View File

@@ -1,7 +1,7 @@
1 1
 #!/bin/bash
2
-#shellcheck disable=SC1091
3 2
 
4 3
 ## hack to workaround Fedora/Red Hat bug 878428
4
+#shellcheck disable=SC1091
5 5
 test -f /usr/share/git-core/contrib/completion/git-prompt.sh \
6 6
  && . /usr/share/git-core/contrib/completion/git-prompt.sh
7 7
 
@@ -147,7 +147,7 @@ gitcd() {
147 147
     #
148 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 153
 clsz() {
@@ -171,7 +171,7 @@ strip_colors() {
171 171
     #
172 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 177
 vims() {
@@ -200,6 +200,7 @@ vims() {
200 200
     # disaster.
201 201
     #
202 202
     local swap="$HOME/.local/share/vim/swap"
203
+    #shellcheck disable=SC1117
203 204
     find "$swap" -type f -print0 \
204 205
       | xargs -0 -r stat -c "%y %n" \
205 206
       | sed "
@@ -346,7 +347,8 @@ xod() {
346 347
     #     rm useful_name.txt
347 348
     #
348 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 352
     xclip -o > "$tmp/$name"
351 353
     echo "$tmp/$name"
352 354
 }
@@ -356,7 +358,8 @@ xood() {
356 358
     # Just like xod() but using xoo (i.e. 'clipboard' clipboard)
357 359
     #
358 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 363
     xclip -selection clipboard -o > "$tmp/$name"
361 364
     echo "$tmp/$name"
362 365
 }
@@ -502,9 +505,13 @@ export LESS=' -R '
502 505
 export PRETTY=color
503 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 515
 export GIT_PAGER='less -S'
509 516
 
510 517
 # disable mounting things like SFTP to ~/.gvfs when accessed