Skip to content

Commit

Permalink
Merge pull request Bash-it#2047 from gaelicWizard/alias/shfmt
Browse files Browse the repository at this point in the history
Aliases: lint the entire folder
  • Loading branch information
NoahGorny authored Feb 16, 2022
2 parents caae145 + 12a734c commit 187916d
Show file tree
Hide file tree
Showing 48 changed files with 281 additions and 317 deletions.
2 changes: 1 addition & 1 deletion aliases/available/ag.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cite 'about-alias'
# shellcheck shell=bash
about-alias 'the silver searcher (ag) aliases'

## Summary for args to less:
Expand Down
2 changes: 1 addition & 1 deletion aliases/available/ansible.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cite 'about-alias'
# shellcheck shell=bash
about-alias 'ansible abbreviations'

alias ans=ansible
Expand Down
6 changes: 2 additions & 4 deletions aliases/available/apt.aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ cite 'about-alias'
about-alias 'Apt and dpkg aliases for Ubuntu and Debian distros.'

# set apt aliases
function _set_pkg_aliases()
{
if _command_exists apt
then
function _set_pkg_aliases() {
if _command_exists apt; then
alias apts='apt-cache search'
alias aptshow='apt-cache show'
alias aptinst='sudo apt-get install -V'
Expand Down
2 changes: 1 addition & 1 deletion aliases/available/atom.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cite 'about-alias'
# shellcheck shell=bash
about-alias 'Atom.io editor abbreviations'

alias a='atom'
Expand Down
2 changes: 1 addition & 1 deletion aliases/available/bash-it.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cite about-alias
# shellcheck shell=bash
about-alias 'Aliases for the bash-it command (these aliases are automatically included with the "general" aliases)'

# Common misspellings of bash-it
Expand Down
2 changes: 1 addition & 1 deletion aliases/available/bolt.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cite 'about-alias'
# shellcheck shell=bash
about-alias 'puppet bolt aliases'

# Aliases
Expand Down
2 changes: 1 addition & 1 deletion aliases/available/bundler.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cite 'about-alias'
# shellcheck shell=bash
about-alias 'ruby bundler'

# Bundler Commands
Expand Down
1 change: 0 additions & 1 deletion aliases/available/clipboard.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# shellcheck shell=bash
cite 'about-alias'
about-alias 'xclip shortcuts'

alias pbcopy="xclip -selection clipboard"
Expand Down
2 changes: 1 addition & 1 deletion aliases/available/composer.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cite 'about-alias'
# shellcheck shell=bash
about-alias 'common composer abbreviations'

# Aliases
Expand Down
28 changes: 12 additions & 16 deletions aliases/available/curl.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
#!/bin/bash

cite 'about-alias'
# shellcheck shell=bash
about-alias 'Curl aliases for convenience.'

# set apt aliases
function _set_pkg_aliases()
{
if _command_exists curl
then
function _set_pkg_aliases() {
if _command_exists curl; then
# follow redirects
alias cl='curl -L'
# follow redirects, download as original name
alias clo='curl -L -O'
# follow redirects, download as original name, continue
alias cloc='curl -L -C - -O'
# follow redirects, download as original name, continue, retry 5 times
alias clocr='curl -L -C - -O --retry 5'
# follow redirects, fetch banner
alias clb='curl -L -I'
alias cl='curl -L'
# follow redirects, download as original name
alias clo='curl -L -O'
# follow redirects, download as original name, continue
alias cloc='curl -L -C - -O'
# follow redirects, download as original name, continue, retry 5 times
alias clocr='curl -L -C - -O --retry 5'
# follow redirects, fetch banner
alias clb='curl -L -I'
# see only response headers from a get request
alias clhead='curl -D - -so /dev/null'
fi
Expand Down
1 change: 0 additions & 1 deletion aliases/available/dnf.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# shellcheck shell=bash
cite 'about-alias'
about-alias 'dnf aliases for fedora 22+ distros'

alias dnfl="dnf list" # List packages
Expand Down
2 changes: 1 addition & 1 deletion aliases/available/docker-compose.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cite 'about-alias'
# shellcheck shell=bash
about-alias 'docker-compose abbreviations'

alias dco="docker-compose"
Expand Down
44 changes: 22 additions & 22 deletions aliases/available/docker.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
cite 'about-alias'
# shellcheck shell=bash
about-alias 'docker abbreviations'

alias dk='docker'
alias dklc='docker ps -l' # List last Docker container
alias dklcid='docker ps -l -q' # List last Docker container ID
alias dklcip='docker inspect -f "{{.NetworkSettings.IPAddress}}" $(docker ps -l -q)' # Get IP of last Docker container
alias dkps='docker ps' # List running Docker containers
alias dkpsa='docker ps -a' # List all Docker containers
alias dki='docker images' # List Docker images
alias dkrmac='docker rm $(docker ps -a -q)' # Delete all Docker containers
alias dklc='docker ps -l' # List last Docker container
alias dklcid='docker ps -l -q' # List last Docker container ID
alias dklcip='docker inspect -f "{{.NetworkSettings.IPAddress}}" $(docker ps -l -q)' # Get IP of last Docker container
alias dkps='docker ps' # List running Docker containers
alias dkpsa='docker ps -a' # List all Docker containers
alias dki='docker images' # List Docker images
alias dkrmac='docker rm $(docker ps -a -q)' # Delete all Docker containers

case $OSTYPE in
darwin*|*bsd*|*BSD*)
alias dkrmui='docker images -q -f dangling=true | xargs docker rmi' # Delete all untagged Docker images
;;
*)
alias dkrmui='docker images -q -f dangling=true | xargs -r docker rmi' # Delete all untagged Docker images
;;
darwin* | *bsd* | *BSD*)
alias dkrmui='docker images -q -f dangling=true | xargs docker rmi' # Delete all untagged Docker images
;;
*)
alias dkrmui='docker images -q -f dangling=true | xargs -r docker rmi' # Delete all untagged Docker images
;;
esac

if [ ! -z "$(command ls "${BASH_IT}/enabled/"{[0-9][0-9][0-9]${BASH_IT_LOAD_PRIORITY_SEPARATOR}docker,docker}.plugin.bash 2>/dev/null | head -1)" ]; then
# Function aliases from docker plugin:
alias dkrmlc='docker-remove-most-recent-container' # Delete most recent (i.e., last) Docker container
alias dkrmall='docker-remove-stale-assets' # Delete all untagged images and exited containers
alias dkrmli='docker-remove-most-recent-image' # Delete most recent (i.e., last) Docker image
alias dkrmi='docker-remove-images' # Delete images for supplied IDs or all if no IDs are passed as arguments
alias dkideps='docker-image-dependencies' # Output a graph of image dependencies using Graphiz
alias dkre='docker-runtime-environment' # List environmental variables of the supplied image ID
if _bash-it-component-item-is-enabled plugin docker; then
# Function aliases from docker plugin:
alias dkrmlc='docker-remove-most-recent-container' # Delete most recent (i.e., last) Docker container
alias dkrmall='docker-remove-stale-assets' # Delete all untagged images and exited containers
alias dkrmli='docker-remove-most-recent-image' # Delete most recent (i.e., last) Docker image
alias dkrmi='docker-remove-images' # Delete images for supplied IDs or all if no IDs are passed as arguments
alias dkideps='docker-image-dependencies' # Output a graph of image dependencies using Graphiz
alias dkre='docker-runtime-environment' # List environmental variables of the supplied image ID
fi
alias dkelc='docker exec -it $(dklcid) bash --login' # Enter last container (works with Docker 1.3 and above)
alias dkrmflast='docker rm -f $(dklcid)'
Expand Down
24 changes: 12 additions & 12 deletions aliases/available/emacs.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
cite 'about-alias'
# shellcheck shell=bash
about-alias 'emacs editor'

case $OSTYPE in
linux*)
alias em='emacs'
alias en='emacs -nw'
alias e='emacsclient -n'
alias et='emacsclient -t'
alias ed='emacs --daemon'
alias E='SUDO_EDITOR=emacsclient sudo -e'
;;
darwin*)
alias em='open -a emacs'
;;
linux*)
alias em='emacs'
alias en='emacs -nw'
alias e='emacsclient -n'
alias et='emacsclient -t'
alias ed='emacs --daemon'
alias E='SUDO_EDITOR=emacsclient sudo -e'
;;
darwin*)
alias em='open -a emacs'
;;
esac
6 changes: 3 additions & 3 deletions aliases/available/fuck.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cite 'about-alias'
# shellcheck shell=bash
about-alias 'fuck/please to retry last command with sudo'

# Play nicely with 'thefuck' plugin
if ! _command_exists fuck ; then
alias fuck='sudo $(fc -ln -1)'
if ! _command_exists fuck; then
alias fuck='sudo $(fc -ln -1)'
fi
alias please=fuck
alias plz=please
Expand Down
64 changes: 29 additions & 35 deletions aliases/available/general.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,50 +1,45 @@
cite about-alias
# shellcheck shell=bash
about-alias 'general aliases'

if ls --color -d . &> /dev/null
then
alias ls="ls --color=auto"
elif ls -G -d . &> /dev/null
then
alias ls='ls -G' # Compact view, show colors
if command ls --color -d . &> /dev/null; then
alias ls='ls --color=auto'
# BSD `ls` doesn't need an argument (`-G`) when `$CLICOLOR` is set.
fi

# List directory contents
alias sl=ls
alias la='ls -AF' # Compact view, show hidden
alias la='ls -AF' # Compact view, show hidden
alias ll='ls -al'
alias l='ls -a'
alias l1='ls -1'
alias lf='ls -F'

alias _="sudo"
alias _='sudo'

# Shortcuts to edit startup files
alias vbrc="vim ~/.bashrc"
alias vbpf="vim ~/.bash_profile"
alias vbrc='${VISUAL:-vim} ~/.bashrc'
alias vbpf='${VISUAL:-vim} ~/.bash_profile'

# colored grep
# Need to check an existing file for a pattern that will be found to ensure
# that the check works when on an OS that supports the color option
if grep --color=auto "a" "${BASH_IT}/"*.md &> /dev/null
then
alias grep='grep --color=auto'
if command grep --color=auto "a" "${BASH_IT?}"/*.md &> /dev/null; then
alias grep='grep --color=auto'
fi

if _command_exists gshuf
then
alias shuf=gshuf
if _command_exists gshuf; then
alias shuf=gshuf
fi

alias c='clear'
alias cls='clear'

alias edit="$EDITOR"
alias pager="$PAGER"
alias edit='${EDITOR:-${ALTERNATE_EDITOR?}}'
alias pager='${PAGER:=less}'

alias q='exit'

alias irc="${IRC_CLIENT:=irc}"
alias irc='${IRC_CLIENT:=irc}'

# Language aliases
alias rb='ruby'
Expand All @@ -65,31 +60,30 @@ alias -- -='cd -' # Go back
alias h='history'

# Tree
if ! _command_exists tree
then
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
if ! _command_exists tree; then
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
fi

# Directory
alias md='mkdir -p'
alias rd='rmdir'

# Shorten extract
alias xt="extract"
alias xt='extract'

# sudo editors
alias svim="sudo vim"
alias snano="sudo nano"
alias svim='sudo ${VISUAL:-vim}'
alias snano='sudo nano'

# Display whatever file is regular file or folder
catt() {
for i in "$@"; do
if [ -d "$i" ]; then
ls "$i"
else
cat "$i"
fi
done
function catt() {
for i in "$@"; do
if [[ -d "$i" ]]; then
ls "$i"
else
cat "$i"
fi
done
}

# The Bash-it aliases were moved to the `bash-it.aliases.bash` file. The intent of this
Expand All @@ -98,5 +92,5 @@ catt() {
# aliases and enable just the ones for Bash-it explicitly:
# bash-it disable alias general
# bash-it enable alias bash-it
# shellcheck source=./bash-it.aliases.bash
# shellcheck source-path=SCRIPTDIR
source "$BASH_IT/aliases/available/bash-it.aliases.bash"
1 change: 0 additions & 1 deletion aliases/available/git.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# shellcheck shell=bash
cite 'about-alias'
about-alias 'common git abbreviations'

alias g='git'
Expand Down
2 changes: 1 addition & 1 deletion aliases/available/gitsvn.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cite 'about-alias'
# shellcheck shell=bash
about-alias 'common git-svn abbreviations'

# Aliases
Expand Down
2 changes: 1 addition & 1 deletion aliases/available/heroku.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cite 'about-alias'
# shellcheck shell=bash
about-alias 'heroku task abbreviations'

# heroku
Expand Down
2 changes: 1 addition & 1 deletion aliases/available/hg.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cite 'about-alias'
# shellcheck shell=bash
about-alias 'mercurial abbreviations'

alias hs='hg status'
Expand Down
6 changes: 2 additions & 4 deletions aliases/available/homebrew-cask.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Some aliases for Homebrew Cask

cite 'about-alias'
about-alias 'homebrew-cask abbreviations'
# shellcheck shell=bash
about-alias 'Some aliases for Homebrew Cask'

alias bcin='brew cask install'
alias bcrm='brew cask uninstall'
Expand Down
6 changes: 2 additions & 4 deletions aliases/available/homebrew.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Some aliases for Homebrew

cite 'about-alias'
about-alias 'homebrew abbreviations'
# shellcheck shell=bash
about-alias 'Some aliases for Homebrew'

alias bup='brew update && brew upgrade'
alias bout='brew outdated'
Expand Down
3 changes: 1 addition & 2 deletions aliases/available/homesick.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cite 'about-alias'
# shellcheck shell=bash
about-alias 'homesick aliases'

# Aliases
Expand All @@ -19,6 +19,5 @@ alias sikpsh="homesick push dotfiles"
alias sikrc="homesick rc dotfiles"
alias sikpth="homesick show_path dotfiles"
alias sikst="homesick status dotfiles"
alias siktrk="homesick track $1 dotfiles"
alias sikulnk="homesick unlink dotfiles"
alias sikv="homesick version"
2 changes: 1 addition & 1 deletion aliases/available/jitsu.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cite 'about-alias'
# shellcheck shell=bash
about-alias 'jitsu task abbreviations'

# jitsu
Expand Down
Loading

0 comments on commit 187916d

Please sign in to comment.