plugin/base: `shfmt`

Apply `shfmt` using current project settings. My apologies to future `git blame` hunters. ♥
pull/1930/head
John D Pell 2021-09-23 23:08:26 -07:00
parent 45bf7194a2
commit e66019daf1
2 changed files with 110 additions and 113 deletions

View File

@ -78,6 +78,7 @@ completion/available/wpscan.completion.bash
#
plugins/available/alias-completion.plugin.bash
plugins/available/autojump.plugin.bash
plugins/available/base.plugin.bash
plugins/available/basher.plugin.bash
plugins/available/cmd-returned-notify.plugin.bash
plugins/available/direnv.plugin.bash

View File

@ -5,11 +5,9 @@ about-plugin 'miscellaneous tools'
function ips() {
about 'display all ip addresses for this host'
group 'base'
if _command_exists ifconfig
then
if _command_exists ifconfig; then
ifconfig | awk '/inet /{ gsub(/addr:/, ""); print $2 }'
elif _command_exists ip
then
elif _command_exists ip; then
ip addr | grep -oP 'inet \K[\d.]+'
else
echo "You don't have ifconfig or ip command installed!"
@ -30,7 +28,7 @@ function myip() {
list=("http://myip.dnsomatic.com/" "http://checkip.dyndns.com/" "http://checkip.dyndns.org/")
for url in "${list[@]}"; do
if res="$(curl -fs "${url}")"; then
break;
break
fi
done
res="$(echo "$res" | grep -Eo '[0-9\.]+')"
@ -48,7 +46,7 @@ function pickfrom() {
reference "${FUNCNAME[0]}" && return
fi
length="$(wc -l < "$file")"
n=$(( RANDOM * length / 32768 + 1 ))
n=$((RANDOM * length / 32768 + 1))
head -n "$n" "$file" | tail -1
}
@ -69,20 +67,19 @@ function passgen() {
# Create alias pass to passgen when pass isn't installed or
# BASH_IT_LEGACY_PASS is true.
if ! _command_exists pass || [[ "${BASH_IT_LEGACY_PASS:-}" = true ]]
then
if ! _command_exists pass || [[ "${BASH_IT_LEGACY_PASS:-}" = true ]]; then
alias pass=passgen
fi
if _command_exists markdown && _command_exists browser; then
function pmdown() {
function pmdown() {
about 'preview markdown file in a browser'
param '1: markdown file'
example '$ pmdown README.md'
group 'base'
markdown "${1?}" | browser
}
}
fi
function mkcd() {
@ -106,7 +103,7 @@ function lsgrep() {
function quiet() {
about 'what *does* this do?'
group 'base'
nohup "$@" &> /dev/null </dev/null &
nohup "$@" &> /dev/null < /dev/null &
}
function usage() {
@ -124,15 +121,14 @@ function usage() {
}
# shellcheck disable=SC2144 # the glob matches only one file
if [[ ! -e "${BASH_IT?}/plugins/enabled/todo.plugin.bash" \
&& ! -e "${BASH_IT?}/plugins/enabled"/*"${BASH_IT_LOAD_PRIORITY_SEPARATOR-}todo.plugin.bash" ]]
then
# if user has installed todo plugin, skip this...
if [[ ! -e "${BASH_IT?}/plugins/enabled/todo.plugin.bash" &&
! -e "${BASH_IT?}/plugins/enabled"/*"${BASH_IT_LOAD_PRIORITY_SEPARATOR-}todo.plugin.bash" ]]; then
# if user has installed todo plugin, skip this...
function t() {
about 'one thing todo'
param 'if not set, display todo item'
param '1: todo text'
if [[ "$*" == "" ]] ; then
if [[ "$*" == "" ]]; then
cat ~/.t
else
echo "$*" > ~/.t
@ -141,7 +137,7 @@ then
fi
if _command_exists mkisofs; then
function mkiso() {
function mkiso() {
about 'creates iso from current dir in the parent dir (unless defined)'
param '1: ISO name'
param '2: dest/path'
@ -160,7 +156,7 @@ function mkiso() {
else
echo "${destpath%/}/${isoname}.iso already exists"
fi
}
}
fi
# useful for administrators and configs
@ -174,11 +170,11 @@ function buf() {
}
if ! _command_exists del; then
function del() {
function del() {
about 'move files to hidden folder in tmp, that gets cleared on each reboot'
param 'file or folder to be deleted'
example 'del ./file.txt'
group 'base'
mkdir -p /tmp/.trash && mv "$@" /tmp/.trash;
}
mkdir -p /tmp/.trash && mv "$@" /tmp/.trash
}
fi