Update profiles shell functions

main
Buddy Sandidge 2 years ago
parent 27204f11df
commit f609cbde9a

@ -6,6 +6,12 @@ HISTSIZE=
MAN_DIR=${XDG_DATA_HOME}/man/man1
PATH=${XDG_BIN_HOME}:${PATH}
{{- if lookPath "nvim" }}
EDITOR=nvim
{{- else }}
EDITOR=vim
{{- end }}
{{ if lookPath "bat" -}}
BAT_PAGER=never
BAT_STYLE=plain

@ -1,5 +1,8 @@
# shellcheck shell=bash
#ft=sh
alias node_lts="curl --silent https://nodejs.org/dist/index.tab | cut -f 1,10 | grep -v '-' | head -n 2 | tail -n 1 | cut -f 1"
alias node_current="curl --silent https://nodejs.org/dist/index.tab | cut -f 1,10 | grep '-' | head -n 1 | cut -f 1"
{{ if lookPath "nvim" -}}
alias vim=nvim
{{- end }}
# vim: filetype=sh

@ -1,13 +1,6 @@
#ft=sh
# vim: filetype=sh
#shellcheck shell=sh
if type nvim >/dev/null 2>/dev/null; then
export EDITOR=nvim
alias vim=nvim
else
export EDITOR=vim
fi
source_env_file() {
if [ ! -f "${1}" ]; then
return
@ -36,15 +29,13 @@ get_bitrate() (
echo "[ERROR] unknown file: $1"
exit 1
fi
if ! command -v exiftool >/dev/null; then
echo "[ERROR] exiftool not installed"
exit 1
fi
command_installed exiftool
exiftool -AudioBitrate "$1" | awk '{print $4}'
)
json_to_yaml() (
ARG=${1-}
command_installed bat dasel
if [ -z "${ARG}" ]; then
dasel --read json --write yaml | bat --language yaml
elif [ -f "${ARG}" ]; then
@ -56,6 +47,7 @@ json_to_yaml() (
yaml_to_json() (
ARG=${1-}
command_installed bat dasel
if [ -z "${ARG}" ]; then
dasel --read yaml --write json | bat --language json
elif [ -f "${ARG}" ]; then
@ -68,6 +60,7 @@ yaml_to_json() (
github_releases() (
USER=${1}
REPO=${2-}
command_installed curl
if [ -z "${REPO}" ]; then
USER=$(echo "${1}" | sed 's|/| |g' | awk '{print $1}')
REPO=$(echo "${1}" | sed 's|/| |g' | awk '{print $2}')
@ -79,6 +72,7 @@ github_releases() (
github_tags() (
USER=${1}
REPO=${2-}
command_installed curl jq
if [ -z "${REPO}" ]; then
USER=$(echo "${1}" | sed 's|/| |g' | awk '{print $1}')
REPO=$(echo "${1}" | sed 's|/| |g' | awk '{print $2}')
@ -90,11 +84,12 @@ github_tags() (
command_installed() (
set -ue
cmd=${1}
if ! command -v "${cmd}" 1>&2 >/dev/null; then
echo "${cmd} not installed" 1>&2
exit 1
fi
for cmd in "${@}"; do
if ! command -v "${cmd}" 1>&2 >/dev/null; then
echo "${cmd} not installed" 1>&2
exit 1
fi
done
)
min_jpg() (

@ -1,5 +1,4 @@
{{ if .hellotech -}}
#!/usr/bin/env bash
k8s_last_config () (
dasel --read yaml --write json \
@ -23,4 +22,6 @@ _add_path "/usr/local/opt/mysql-client/bin"
_add_path "${HOME}/google-cloud-sdk/bin"
unset _add_path
# vim: filetype=sh
{{- end }}

@ -2,9 +2,7 @@
# shellcheck shell=sh
if [ "${RBENV_SHELL}" = "" ]; then
if command -v rbenv >/dev/null 2>&1 ; then
eval "$(rbenv init -)"
fi
eval "$(rbenv init -)"
fi
{{- end }}

Loading…
Cancel
Save