mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 12:26:39 +00:00
Format shell scripts with shfmt
This commit is contained in:
@@ -72,29 +72,29 @@ authmeo() {
|
||||
# Make and cd into directory
|
||||
# - from: http://alias.sh/make-and-cd-directory
|
||||
mcd() {
|
||||
mkdir -p "$1" && cd "$1";
|
||||
mkdir -p "$1" && cd "$1"
|
||||
}
|
||||
|
||||
# Extract most common archives with single command.
|
||||
# - from: http://alias.sh/extract-most-know-archives-one-command
|
||||
extract() {
|
||||
if [ -f $1 ] ; then
|
||||
if [ -f $1 ]; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xvjf $1 ;;
|
||||
*.tar.gz) tar xvzf $1 ;;
|
||||
*.tar.xz) tar xvJf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.rar) unrar e $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xvf $1 ;;
|
||||
*.tbz2) tar xvjf $1 ;;
|
||||
*.tbz) tar xvjf $1 ;;
|
||||
*.tgz) tar xvzf $1 ;;
|
||||
*.txz) tar xvJf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.Z) uncompress $1 ;;
|
||||
*.7z) 7z x $1 ;;
|
||||
*) echo "'$1' cannot be extracted via extract()" ;;
|
||||
*.tar.bz2) tar xvjf $1 ;;
|
||||
*.tar.gz) tar xvzf $1 ;;
|
||||
*.tar.xz) tar xvJf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.rar) unrar e $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xvf $1 ;;
|
||||
*.tbz2) tar xvjf $1 ;;
|
||||
*.tbz) tar xvjf $1 ;;
|
||||
*.tgz) tar xvzf $1 ;;
|
||||
*.txz) tar xvJf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.Z) uncompress $1 ;;
|
||||
*.7z) 7z x $1 ;;
|
||||
*) echo "'$1' cannot be extracted via extract()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
|
||||
@@ -6,7 +6,7 @@ alias d="docker"
|
||||
alias dc="docker-compose"
|
||||
alias co="docker-compose"
|
||||
|
||||
docker_remove_exited () {
|
||||
docker_remove_exited() {
|
||||
docker rm "$(docker ps -f='status=exited' -q)"
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Go (golang) setup.
|
||||
#
|
||||
|
||||
install_go_global_packages () {
|
||||
install_go_global_packages() {
|
||||
local packages=(
|
||||
github.com/akavel/up
|
||||
github.com/asciimoo/wuzz
|
||||
|
||||
@@ -8,7 +8,7 @@ alias flush_dns="dscacheutil -flushcache"
|
||||
alias open_ports="sudo lsof -i -Pn | grep LISTEN"
|
||||
|
||||
# Open man page in Preview.
|
||||
pman () {
|
||||
pman() {
|
||||
man -t "${1}" | open -f -a /Applications/Preview.app
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ alias unfix_wifi="sudo ifconfig awdl0 up"
|
||||
# Disable the system built-in cmd+ctrl+d global hotkey to lookup word in
|
||||
# dictionary on OS X. Must reboot after running.
|
||||
# - from: ://apple.stackexchange.com/a/114269
|
||||
osx-disable-lookup-word-hotkey () {
|
||||
osx-disable-lookup-word-hotkey() {
|
||||
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 70 \
|
||||
'<dict><key>enabled</key><false/></dict>'
|
||||
'<dict><key>enabled</key><false/></dict>'
|
||||
echo "Command-Control-D hotkey disabled. Please reboot to take effect."
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ alias osx-enable-lowpri-throttle='sudo sysctl debug.lowpri_throttle_enabled=1'
|
||||
# Set all relevant power management settings to force the machine to save a
|
||||
# sleep image and immediately enter "standby" along with FileVault destroying
|
||||
# disk decryption keys.
|
||||
pm-hibernate () {
|
||||
pm-hibernate() {
|
||||
sudo pmset -a hibernatemode 25
|
||||
sudo pmset -a standby 1
|
||||
sudo pmset -a standbydelayhigh 0
|
||||
@@ -50,7 +50,7 @@ pm-hibernate () {
|
||||
|
||||
# Restore all settings modified by pm-hibernate to their defaults, effectively
|
||||
# restoring default sleep behavior for macOS laptops.
|
||||
pm-safesleep () {
|
||||
pm-safesleep() {
|
||||
sudo pmset -a hibernatemode 3
|
||||
sudo pmset -a standbydelayhigh 86400
|
||||
sudo pmset -a standbydelaylow 0
|
||||
@@ -59,13 +59,13 @@ pm-safesleep () {
|
||||
}
|
||||
|
||||
# Trigger hibernation now.
|
||||
hibernate () {
|
||||
hibernate() {
|
||||
pm-hibernate
|
||||
sudo pmset sleepnow
|
||||
}
|
||||
|
||||
# Trigger a safe-sleep now.
|
||||
safesleep () {
|
||||
safesleep() {
|
||||
pm-safesleep
|
||||
sudo pmset sleepnow
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ alias ngi="npm install -g"
|
||||
alias cof="coffee"
|
||||
alias tl="tldr"
|
||||
|
||||
install_node_global_packages () {
|
||||
install_node_global_packages() {
|
||||
local packages=(
|
||||
@prettier/plugin-php
|
||||
@prettier/plugin-ruby
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Python environment setup
|
||||
#
|
||||
|
||||
install_python_global_packages () {
|
||||
install_python_global_packages() {
|
||||
local packages=(
|
||||
'ansible'
|
||||
'grip'
|
||||
|
||||
36
zsh/ruby.zsh
36
zsh/ruby.zsh
@@ -2,7 +2,7 @@
|
||||
# Ruby environment setup.
|
||||
#
|
||||
|
||||
install_ruby_global_packages () {
|
||||
install_ruby_global_packages() {
|
||||
local packages=(
|
||||
'bundler:~> 1.0'
|
||||
'bundler:~> 2.0'
|
||||
@@ -68,39 +68,39 @@ if command-exists rbenv; then
|
||||
unset -f load-rbenv _rbenv rbenv
|
||||
eval "$(command rbenv init -)"
|
||||
}
|
||||
|
||||
rbenv-each-version () {
|
||||
local current_version="$RBENV_VERSION"
|
||||
|
||||
for v in $(ls "${HOME}/.rbenv/versions"); do
|
||||
echo "==> Ruby $v:"
|
||||
export RBENV_VERSION="$v"
|
||||
eval $*
|
||||
done
|
||||
|
||||
export RBENV_VERSION="$current_version"
|
||||
}
|
||||
fi
|
||||
|
||||
rbenv-each-version() {
|
||||
local current_version="$RBENV_VERSION"
|
||||
|
||||
for v in $(ls "${HOME}/.rbenv/versions"); do
|
||||
echo "==> Ruby $v:"
|
||||
export RBENV_VERSION="$v"
|
||||
eval $*
|
||||
done
|
||||
|
||||
export RBENV_VERSION="$current_version"
|
||||
}
|
||||
|
||||
# Solargraph related commands
|
||||
|
||||
solargraph-install () {
|
||||
solargraph-install() {
|
||||
rbenv-each-version "gem install solargraph"
|
||||
}
|
||||
|
||||
solargraph-download-cores () {
|
||||
solargraph-download-cores() {
|
||||
rbenv-each-version "solargraph download-core"
|
||||
}
|
||||
|
||||
solargraph-list-versions () {
|
||||
solargraph-list-versions() {
|
||||
rbenv-each-version "gem list -q solargraph"
|
||||
}
|
||||
|
||||
rubygems-upgrade () {
|
||||
rubygems-upgrade() {
|
||||
rbenv-each-version "gem update --system"
|
||||
}
|
||||
|
||||
upgrade-bundler () {
|
||||
upgrade-bundler() {
|
||||
rbenv-each-version \
|
||||
"gem install --no-document 'bundler:~> 1.0' 'bundler:~> 2.0'"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user