systemctl list-unit-files | rg "$@"
}
-# test for whether we generally want to do sk on the file
-sk-p() {
- [[ ! -L $f ]] && istext "$1" && [[ $(head -n1 "$1" 2>/dev/null) == '#!/bin/bash'* ]]
+# test for whether we generally want to do shk on the file
+shk-p() {
+ local fname="${1##*/}"
+ [[ ! -L $1 && ( $fname == *.sh || $fname != *.* ) ]] && istext "$1" && [[ $(head -n1 "$1" 2>/dev/null) == '#!/bin/bash'* ]]
}
shellcheck-except() {
local quotes others
fi
}
-# sk with quotes. For checking scripts that we expect to take untrusted
+# shk with quotes. For checking scripts that we expect to take untrusted
# input in order to verify we quoted vars.
-skq() {
+shkq() {
local others
others=2029,2033,2054,2164
shellcheck -W 999 -x -e $others "$@" || return $?
}
-# sk on all modified & new files in current git repo. must git add for new files.
-skmodified() {
+# shk on all modified & new files in current git repo. must git add for new files.
+shkmodified() {
local f
for f in $(i s | awk '$1 == "modified:" {print $2}; $1 == "new" {print $3}'); do
- if sk-p "$f"; then
- sk $f ||:
+ if shk-p "$f"; then
+ shk $f ||:
fi
done
}
-# sk on all the files in current git repo
-skgit() {
+# shk on all the files in current git repo
+shkgit() {
local f toplevel orig_dir tmp
- local -a ls_files sk_files
+ local -a ls_files shk_files
toplevel=$(git rev-parse --show-toplevel)
if [[ $PWD != "$toplevel" ]]; then
orig_dir=$PWD
tmp=$(git ls-files && git ls-files --others --exclude-standard)
mapfile -t ls_files <<<"$tmp"
for f in "${ls_files[@]}"; do
- if sk-p "$f"; then
- sk_files+=("$f")
+ if shk-p "$f"; then
+ shk_files+=("$f")
fi
done
- sk "${sk_files[@]}"
+ m shk "${shk_files[@]}"
if [[ $orig_dir ]]; then
cd $orig_dir
fi
# The first arg that is an existing file starts the FILES args, or an arg "-".
#
# example shortening:
-# for f in *; do t -x $a && sk $a; done
+# for f in *; do t -x $a && shk $a; done
# becomes
-# fm t -x *; fe sk
+# fm t -x *; fe shk
fm() {
local file end_arg=false in_files=false
local -a files cmd