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