Merge pull request #2047 from gaelicWizard/alias/shfmt

Aliases: lint the entire folder
This commit is contained in:
Noah Gorny
2022-02-16 22:47:36 +02:00
committed by GitHub
48 changed files with 281 additions and 317 deletions

View File

@@ -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'
@@ -65,9 +60,8 @@ 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
@@ -75,21 +69,21 @@ 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
@@ -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"