aboutsummaryrefslogtreecommitdiff
path: root/sh/shrc.d
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-12-17 15:10:18 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-12-17 15:12:55 +1300
commit06dae018ff0b41bc6140a603f5cbf2b54b2fd3ae (patch)
tree7be425ef1a1eb11ad6f7ff1c8d55bb0f06e0d6d0 /sh/shrc.d
parentAdd /j flag to :vimgrep shortcut (diff)
downloaddotfiles-06dae018ff0b41bc6140a603f5cbf2b54b2fd3ae.tar.gz
dotfiles-06dae018ff0b41bc6140a603f5cbf2b54b2fd3ae.zip
Use `command` consistently, silence ShellCheck
ShellCheck (SC2164) is upset about these `cd` commands where the return type isn't being checked, but they're all by design, as they're the last command in the function, and thereby constitute the function's return value implicitly. Otherwise, this commit changes the shrc.d and profile.d subfiles to use the `command` wrapper only where it's actually needed.
Diffstat (limited to 'sh/shrc.d')
-rw-r--r--sh/shrc.d/bd.sh3
-rw-r--r--sh/shrc.d/gd.sh3
-rw-r--r--sh/shrc.d/gt.sh3
-rw-r--r--sh/shrc.d/mkcd.sh5
-rw-r--r--sh/shrc.d/pd.sh3
-rw-r--r--sh/shrc.d/rd.sh3
-rw-r--r--sh/shrc.d/scr.sh3
-rw-r--r--sh/shrc.d/sd.sh3
-rw-r--r--sh/shrc.d/ud.sh3
-rw-r--r--sh/shrc.d/vr.sh3
10 files changed, 21 insertions, 11 deletions
diff --git a/sh/shrc.d/bd.sh b/sh/shrc.d/bd.sh
index 29bde513..a942af6b 100644
--- a/sh/shrc.d/bd.sh
+++ b/sh/shrc.d/bd.sh
@@ -43,5 +43,6 @@ bd() {
fi
# We have a match; try and change into it
- command cd -- "$1"
+ # shellcheck disable=SC2164
+ cd -- "$1"
}
diff --git a/sh/shrc.d/gd.sh b/sh/shrc.d/gd.sh
index 9f6a43e7..b9af480e 100644
--- a/sh/shrc.d/gd.sh
+++ b/sh/shrc.d/gd.sh
@@ -14,5 +14,6 @@ gd() {
fi
# Go to the marked directory
- cd -- "$PMD" || return
+ # shellcheck disable=SC2164
+ cd -- "$PMD"
}
diff --git a/sh/shrc.d/gt.sh b/sh/shrc.d/gt.sh
index 7a52571d..193a2996 100644
--- a/sh/shrc.d/gt.sh
+++ b/sh/shrc.d/gt.sh
@@ -24,5 +24,6 @@ gt() {
fi
# Try to change into the determined directory, or root if empty
- command cd -- "${1:-/}"
+ # shellcheck disable=SC2164
+ cd -- "${1:-/}"
}
diff --git a/sh/shrc.d/mkcd.sh b/sh/shrc.d/mkcd.sh
index cd882b51..bfe8a142 100644
--- a/sh/shrc.d/mkcd.sh
+++ b/sh/shrc.d/mkcd.sh
@@ -1,5 +1,6 @@
# Create a directory and change into it
mkcd() {
- command -p mkdir -p -- "$1" || return
- command cd -- "$1"
+ mkdir -p -- "$1" || return
+ # shellcheck disable=SC2164
+ cd -- "$1"
}
diff --git a/sh/shrc.d/pd.sh b/sh/shrc.d/pd.sh
index e3a6daaa..d5257ba5 100644
--- a/sh/shrc.d/pd.sh
+++ b/sh/shrc.d/pd.sh
@@ -27,5 +27,6 @@ pd() {
set -- "${1%/*}"
# Try to change into the determined directory, or root if empty
- command cd -- "${1:-/}"
+ # shellcheck disable=SC2164
+ cd -- "${1:-/}"
}
diff --git a/sh/shrc.d/rd.sh b/sh/shrc.d/rd.sh
index 9633713a..5fbd5ac5 100644
--- a/sh/shrc.d/rd.sh
+++ b/sh/shrc.d/rd.sh
@@ -35,5 +35,6 @@ rd() {
esac
# Try to change into the determined directory
- command cd -- "$1"
+ # shellcheck disable=SC2164
+ cd -- "$1"
}
diff --git a/sh/shrc.d/scr.sh b/sh/shrc.d/scr.sh
index 9af8dd74..14a58ad1 100644
--- a/sh/shrc.d/scr.sh
+++ b/sh/shrc.d/scr.sh
@@ -2,5 +2,6 @@
# files into $HOME, and making the system do cleanup for me. Single optional
# argument is the string to use for naming the directory; defaults to "scr".
scr() {
- cd -- "$(mktd "${1:-scr}")" || return
+ # shellcheck disable=SC2164
+ cd -- "$(mktd "${1:-scr}")"
}
diff --git a/sh/shrc.d/sd.sh b/sh/shrc.d/sd.sh
index 8b12c170..58d1a375 100644
--- a/sh/shrc.d/sd.sh
+++ b/sh/shrc.d/sd.sh
@@ -113,5 +113,6 @@ sd() {
esac
# Try and change into the first parameter
- command cd -- "$1"
+ # shellcheck disable=SC2164
+ cd -- "$1"
}
diff --git a/sh/shrc.d/ud.sh b/sh/shrc.d/ud.sh
index 06234569..f7f33caf 100644
--- a/sh/shrc.d/ud.sh
+++ b/sh/shrc.d/ud.sh
@@ -42,5 +42,6 @@ ud() {
shift
# Try to change into the determined directory, or the root if blank
- command cd -- "${1:-/}"
+ # shellcheck disable=SC2164
+ cd -- "${1:-/}"
}
diff --git a/sh/shrc.d/vr.sh b/sh/shrc.d/vr.sh
index c7057ec2..d9cfda62 100644
--- a/sh/shrc.d/vr.sh
+++ b/sh/shrc.d/vr.sh
@@ -59,5 +59,6 @@ vr() {
[ -n "$1" ] || return
# Try to change into the determined directory
- command cd -- "$@"
+ # shellcheck disable=SC2164
+ cd -- "$@"
}