Dotfiles config update (2022-02-28)
This commit is contained in:
parent
df47531ae0
commit
357889fdda
|
@ -1 +0,0 @@
|
||||||
--ignore-dir=enabled/
|
|
|
@ -1,30 +0,0 @@
|
||||||
# EditorConfig is awesome: http://EditorConfig.org
|
|
||||||
|
|
||||||
[*]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
end_of_line = lf
|
|
||||||
charset = utf-8
|
|
||||||
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
||||||
|
|
||||||
[**.{md,rst}]
|
|
||||||
trim_trailing_whitespace = false
|
|
||||||
|
|
||||||
[.git*]
|
|
||||||
indent_style = tab
|
|
||||||
|
|
||||||
[{**.*sh,test/run}]
|
|
||||||
indent_style = tab
|
|
||||||
indent_size = 4
|
|
||||||
|
|
||||||
shell_variant = bash
|
|
||||||
binary_next_line = true # like -bn
|
|
||||||
switch_case_indent = true # like -ci
|
|
||||||
space_redirects = true # like -sr
|
|
||||||
keep_padding = false # like -kp
|
|
||||||
end_of_line = lf
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
|
@ -1,50 +0,0 @@
|
||||||
# See https://pre-commit.com for more information
|
|
||||||
# See https://pre-commit.com/hooks.html for more hooks
|
|
||||||
---
|
|
||||||
# fail_fast: true
|
|
||||||
minimum_pre_commit_version: 1.18.1
|
|
||||||
exclude: "docs/_build/"
|
|
||||||
repos:
|
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
||||||
rev: v2.3.0
|
|
||||||
hooks:
|
|
||||||
- id: trailing-whitespace
|
|
||||||
exclude: ".(md|rst)$"
|
|
||||||
- id: end-of-file-fixer
|
|
||||||
- id: check-merge-conflict
|
|
||||||
- id: mixed-line-ending
|
|
||||||
- id: check-added-large-files
|
|
||||||
- repo: https://github.com/jumanjihouse/pre-commit-hooks
|
|
||||||
rev: 2.1.5
|
|
||||||
hooks:
|
|
||||||
- id: git-check # Configure in .gitattributes
|
|
||||||
- id: shellcheck
|
|
||||||
exclude: ".bats$"
|
|
||||||
- id: shfmt
|
|
||||||
exclude: ".bats$"
|
|
||||||
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
|
||||||
rev: v1.1.7
|
|
||||||
hooks:
|
|
||||||
# - id: forbid-crlf
|
|
||||||
- id: remove-crlf
|
|
||||||
exclude: ".bat$"
|
|
||||||
- repo: local
|
|
||||||
hooks:
|
|
||||||
- id: dot-sh
|
|
||||||
name: Check .sh files against bash-it requirements
|
|
||||||
entry: ./hooks/dot-sh.sh
|
|
||||||
language: system
|
|
||||||
files: "\\.sh$"
|
|
||||||
types: [file]
|
|
||||||
- id: dot-bash
|
|
||||||
name: Check .bash files against bash-it requirements
|
|
||||||
exclude: "test/test_helper.bash"
|
|
||||||
entry: ./hooks/dot-bash.sh
|
|
||||||
language: system
|
|
||||||
files: "\\.bash$"
|
|
||||||
types: [file]
|
|
||||||
- id: clean-files-txt
|
|
||||||
name: Check that clean_files.txt is sorted alphabetically.
|
|
||||||
entry: ./hooks/check-clean-files-txt.sh
|
|
||||||
language: system
|
|
||||||
files: clean_files.txt
|
|
|
@ -1,10 +0,0 @@
|
||||||
version: 2
|
|
||||||
|
|
||||||
sphinx:
|
|
||||||
builder: htmldir
|
|
||||||
configuration: docs/conf.py
|
|
||||||
|
|
||||||
python:
|
|
||||||
version: 3.7
|
|
||||||
install:
|
|
||||||
- requirements: docs/requirements.txt
|
|
|
@ -1,6 +0,0 @@
|
||||||
# We use colors and not assigned
|
|
||||||
disable=SC2154
|
|
||||||
# Hard to fix
|
|
||||||
disable=SC2155
|
|
||||||
# shellcheck is wrong on some
|
|
||||||
disable=SC2034
|
|
|
@ -1,21 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2020-2021 Bash-it
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
|
@ -1,12 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'the silver searcher (ag) aliases'
|
|
||||||
|
|
||||||
## Summary for args to less:
|
|
||||||
# less(1)
|
|
||||||
# -M (-M or --LONG-PROMPT) Prompt very verbosely
|
|
||||||
# -I (-I or --IGNORE-CASE) Searches with '/' ignore case
|
|
||||||
# -R (-R or --RAW-CONTROL-CHARS) For handling ANSI colors
|
|
||||||
# -F (-F or --quit-if-one-screen) Auto exit if <1 screen
|
|
||||||
# -X (-X or --no-init) Disable termcap init & deinit
|
|
||||||
|
|
||||||
alias ag='ag --smart-case --pager="less -MIRFX"'
|
|
|
@ -1,5 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'ansible abbreviations'
|
|
||||||
|
|
||||||
alias ans=ansible
|
|
||||||
alias ap=ansible-playbook
|
|
|
@ -1,28 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# -binaryanomaly
|
|
||||||
|
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'Apt and dpkg aliases for Ubuntu and Debian distros.'
|
|
||||||
|
|
||||||
# set apt aliases
|
|
||||||
function _set_pkg_aliases()
|
|
||||||
{
|
|
||||||
if [ -x $(which apt) ]; then
|
|
||||||
alias apts='apt-cache search'
|
|
||||||
alias aptshow='apt-cache show'
|
|
||||||
alias aptinst='sudo apt-get install -V'
|
|
||||||
alias aptupd='sudo apt-get update'
|
|
||||||
alias aptupg='sudo apt-get dist-upgrade -V && sudo apt-get autoremove'
|
|
||||||
alias aptupgd='sudo apt-get update && sudo apt-get dist-upgrade -V && sudo apt-get autoremove'
|
|
||||||
alias aptrm='sudo apt-get remove'
|
|
||||||
alias aptpurge='sudo apt-get remove --purge'
|
|
||||||
|
|
||||||
alias chkup='/usr/lib/update-notifier/apt-check -p --human-readable'
|
|
||||||
alias chkboot='cat /var/run/reboot-required'
|
|
||||||
|
|
||||||
alias pkgfiles='dpkg --listfiles'
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
_set_pkg_aliases
|
|
|
@ -1,7 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'Atom.io editor abbreviations'
|
|
||||||
|
|
||||||
alias a='atom'
|
|
||||||
alias ah='atom .'
|
|
||||||
alias apmup='apm update --no-confirm'
|
|
||||||
alias apmi='apm install'
|
|
|
@ -1,23 +0,0 @@
|
||||||
cite about-alias
|
|
||||||
about-alias 'Aliases for the bash-it command (these aliases are automatically included with the "general" aliases)'
|
|
||||||
|
|
||||||
# Common misspellings of bash-it
|
|
||||||
alias shit='bash-it'
|
|
||||||
alias batshit='bash-it'
|
|
||||||
alias bashit='bash-it'
|
|
||||||
alias batbsh='bash-it'
|
|
||||||
alias babsh='bash-it'
|
|
||||||
alias bash_it='bash-it'
|
|
||||||
alias bash_ti='bash-it'
|
|
||||||
|
|
||||||
# Additional bash-it aliases for help/show
|
|
||||||
alias bshsa='bash-it show aliases'
|
|
||||||
alias bshsc='bash-it show completions'
|
|
||||||
alias bshsp='bash-it show plugins'
|
|
||||||
alias bshha='bash-it help aliases'
|
|
||||||
alias bshhc='bash-it help completions'
|
|
||||||
alias bshhp='bash-it help plugins'
|
|
||||||
alias bshsch="bash-it search"
|
|
||||||
alias bshenp="bash-it enable plugin"
|
|
||||||
alias bshena="bash-it enable alias"
|
|
||||||
alias bshenc="bash-it enable completion"
|
|
|
@ -1,8 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'puppet bolt aliases'
|
|
||||||
|
|
||||||
# Aliases
|
|
||||||
alias bolt='bolt command run --tty --no-host-key-check'
|
|
||||||
alias boltas='bolt -p -u'
|
|
||||||
alias sudobolt='bolt --run-as root --sudo-password'
|
|
||||||
alias sudoboltas='sudobolt -p -u'
|
|
|
@ -1,9 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'ruby bundler'
|
|
||||||
|
|
||||||
# Bundler Commands
|
|
||||||
alias be='bundle exec'
|
|
||||||
alias bi='bundle install'
|
|
||||||
alias bl='bundle list'
|
|
||||||
alias bu='bundle update'
|
|
||||||
alias bp='bundle package'
|
|
|
@ -1,17 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'xclip shortcuts'
|
|
||||||
|
|
||||||
alias pbcopy="xclip -selection clipboard"
|
|
||||||
alias pbpaste="xclip -selection clipboard -o"
|
|
||||||
|
|
||||||
alias xcpy="xclip -selection clipboard"
|
|
||||||
alias xpst="xclip -selection clipboard -o"
|
|
||||||
# to use it just install xclip on your distribution and it would work like:
|
|
||||||
# $ echo "hello" | xcpy
|
|
||||||
# $ xpst
|
|
||||||
# hello
|
|
||||||
|
|
||||||
# very useful for things like:
|
|
||||||
# cat ~/.ssh/id_rsa.pub | xcpy
|
|
||||||
# have fun!
|
|
|
@ -1,39 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'common composer abbreviations'
|
|
||||||
|
|
||||||
# Aliases
|
|
||||||
alias coab='composer about'
|
|
||||||
alias coar='composer archive'
|
|
||||||
alias cob='composer browser'
|
|
||||||
alias cocpr='composer check-platform-reqs'
|
|
||||||
alias cocc='composer clear-cache'
|
|
||||||
alias cocfg='composer config'
|
|
||||||
alias cocp='composer create-project'
|
|
||||||
alias codp='composer depends'
|
|
||||||
alias codiag='composer diagnose'
|
|
||||||
alias codmp='composer dump-autoload'
|
|
||||||
alias coex='composer exec'
|
|
||||||
alias coglob='composer global'
|
|
||||||
alias coh='composer help'
|
|
||||||
alias cohome='composer home'
|
|
||||||
alias coi='composer install'
|
|
||||||
alias coinf='composer info'
|
|
||||||
alias coini='composer init'
|
|
||||||
alias coli='composer license'
|
|
||||||
alias colis='composer list'
|
|
||||||
alias coout='composer outdated'
|
|
||||||
alias cop='composer prohibits'
|
|
||||||
alias corem='composer remove'
|
|
||||||
alias coreq='composer require'
|
|
||||||
alias coreqd='composer require --dev'
|
|
||||||
alias cors='composer run-script'
|
|
||||||
alias cos='composer search'
|
|
||||||
alias cosu='composer self-update'
|
|
||||||
alias coshow='composer show'
|
|
||||||
alias costat='composer status'
|
|
||||||
alias cosugg='composer suggest'
|
|
||||||
alias coup='composer update'
|
|
||||||
alias coupg='composer upgrade'
|
|
||||||
alias coval='composer validate'
|
|
||||||
alias cowhy='composer why'
|
|
||||||
alias cowhyn='composer why-not'
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'Curl aliases for convenience.'
|
|
||||||
|
|
||||||
# set apt aliases
|
|
||||||
function _set_pkg_aliases()
|
|
||||||
{
|
|
||||||
if [ -x $(which 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'
|
|
||||||
# see only response headers from a get request
|
|
||||||
alias clhead='curl -D - -so /dev/null'
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
_set_pkg_aliases
|
|
|
@ -1,18 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'dnf aliases for fedora 22+ distros'
|
|
||||||
|
|
||||||
alias dnfl="dnf list" # List packages
|
|
||||||
alias dnfli="dnf list installed" # List installed packages
|
|
||||||
alias dnfgl="dnf grouplist" # List package groups
|
|
||||||
alias dnfmc="dnf makecache" # Generate metadata cache
|
|
||||||
alias dnfp="dnf info" # Show package information
|
|
||||||
alias dnfs="dnf search" # Search package
|
|
||||||
|
|
||||||
alias dnfu="sudo dnf upgrade" # Upgrade package
|
|
||||||
alias dnfi="sudo dnf install" # Install package
|
|
||||||
alias dnfri='sudo dnf reinstall' # Reinstall package
|
|
||||||
alias dnfgi="sudo dnf groupinstall" # Install package group
|
|
||||||
alias dnfr="sudo dnf remove" # Remove package
|
|
||||||
alias dnfgr="sudo dnf groupremove" # Remove package group
|
|
||||||
alias dnfc="sudo dnf clean all" # Clean cache
|
|
|
@ -1,10 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'docker-compose abbreviations'
|
|
||||||
|
|
||||||
alias dco="docker-compose"
|
|
||||||
|
|
||||||
# Defined in the `docker-compose` plugin, please check there for details.
|
|
||||||
alias dcofresh="docker-compose-fresh"
|
|
||||||
alias dcol="docker-compose logs -f --tail 100"
|
|
||||||
alias dcou="docker-compose up"
|
|
||||||
alias dcouns="dcou --no-start"
|
|
|
@ -1,43 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
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
|
|
||||||
|
|
||||||
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
|
|
||||||
;;
|
|
||||||
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
|
|
||||||
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)'
|
|
||||||
alias dkbash='dkelc'
|
|
||||||
alias dkex='docker exec -it ' # Useful to run any commands into container without leaving host
|
|
||||||
alias dkri='docker run --rm -i '
|
|
||||||
alias dkric='docker run --rm -i -v $PWD:/cwd -w /cwd '
|
|
||||||
alias dkrit='docker run --rm -it '
|
|
||||||
alias dkritc='docker run --rm -it -v $PWD:/cwd -w /cwd '
|
|
||||||
|
|
||||||
# Added more recent cleanup options from newer docker versions
|
|
||||||
alias dkip='docker image prune -a -f'
|
|
||||||
alias dkvp='docker volume prune -f'
|
|
||||||
alias dksp='docker system prune -a -f'
|
|
|
@ -1,16 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
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'
|
|
||||||
;;
|
|
||||||
esac
|
|
|
@ -1,10 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
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)'
|
|
||||||
fi
|
|
||||||
alias please=fuck
|
|
||||||
alias plz=please
|
|
||||||
alias fucking=sudo
|
|
|
@ -1,102 +0,0 @@
|
||||||
cite about-alias
|
|
||||||
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
|
|
||||||
fi
|
|
||||||
|
|
||||||
# List directory contents
|
|
||||||
alias sl=ls
|
|
||||||
alias la='ls -AF' # Compact view, show hidden
|
|
||||||
alias ll='ls -al'
|
|
||||||
alias l='ls -a'
|
|
||||||
alias l1='ls -1'
|
|
||||||
|
|
||||||
alias _="sudo"
|
|
||||||
|
|
||||||
# Shortcuts to edit startup files
|
|
||||||
alias vbrc="vim ~/.bashrc"
|
|
||||||
alias vbpf="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'
|
|
||||||
fi
|
|
||||||
|
|
||||||
if which gshuf &> /dev/null
|
|
||||||
then
|
|
||||||
alias shuf=gshuf
|
|
||||||
fi
|
|
||||||
|
|
||||||
alias c='clear'
|
|
||||||
alias k='clear'
|
|
||||||
alias cls='clear'
|
|
||||||
|
|
||||||
alias edit="$EDITOR"
|
|
||||||
alias pager="$PAGER"
|
|
||||||
|
|
||||||
alias q='exit'
|
|
||||||
|
|
||||||
alias irc="${IRC_CLIENT:=irc}"
|
|
||||||
|
|
||||||
# Language aliases
|
|
||||||
alias rb='ruby'
|
|
||||||
alias py='python'
|
|
||||||
alias ipy='ipython'
|
|
||||||
|
|
||||||
# Pianobar can be found here: http://github.com/PromyLOPh/pianobar/
|
|
||||||
|
|
||||||
alias piano='pianobar'
|
|
||||||
|
|
||||||
alias ..='cd ..' # Go up one directory
|
|
||||||
alias cd..='cd ..' # Common misspelling for going up one directory
|
|
||||||
alias ...='cd ../..' # Go up two directories
|
|
||||||
alias ....='cd ../../..' # Go up three directories
|
|
||||||
alias -- -='cd -' # Go back
|
|
||||||
|
|
||||||
# Shell History
|
|
||||||
alias h='history'
|
|
||||||
|
|
||||||
# Tree
|
|
||||||
if [ ! -x "$(which tree 2>/dev/null)" ]
|
|
||||||
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"
|
|
||||||
|
|
||||||
# sudo editors
|
|
||||||
alias svim="sudo 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
|
|
||||||
}
|
|
||||||
|
|
||||||
# The Bash-it aliases were moved to the `bash-it.aliases.bash` file. The intent of this
|
|
||||||
# is to keep the script readable and less bloated. If you don't need to use
|
|
||||||
# the `general` aliases, but you want the Bash-it aliases, you can disable the `general`
|
|
||||||
# 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
|
|
||||||
source "$BASH_IT/aliases/available/bash-it.aliases.bash"
|
|
|
@ -1,207 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'common git abbreviations'
|
|
||||||
|
|
||||||
alias g='git'
|
|
||||||
alias get='git'
|
|
||||||
|
|
||||||
# add
|
|
||||||
alias ga='git add'
|
|
||||||
alias gall='git add -A'
|
|
||||||
alias gap='git add -p'
|
|
||||||
|
|
||||||
# branch
|
|
||||||
alias gb='git branch'
|
|
||||||
alias gbD='git branch -D'
|
|
||||||
alias gba='git branch -a'
|
|
||||||
alias gbd='git branch -d'
|
|
||||||
alias gbm='git branch -m'
|
|
||||||
alias gbt='git branch --track'
|
|
||||||
alias gdel='git branch -D'
|
|
||||||
|
|
||||||
# for-each-ref
|
|
||||||
alias gbc='git for-each-ref --format="%(authorname) %09 %(if)%(HEAD)%(then)*%(else)%(refname:short)%(end) %09 %(creatordate)" refs/remotes/ --sort=authorname DESC' # FROM https://stackoverflow.com/a/58623139/10362396
|
|
||||||
|
|
||||||
# commit
|
|
||||||
alias gc='git commit -v'
|
|
||||||
alias gca='git commit -v -a'
|
|
||||||
alias gcaa='git commit -a --amend -C HEAD' # Add uncommitted and unstaged changes to the last commit
|
|
||||||
alias gcam='git commit -v -am'
|
|
||||||
alias gcamd='git commit --amend'
|
|
||||||
alias gcm='git commit -v -m'
|
|
||||||
alias gci='git commit --interactive'
|
|
||||||
alias gcsam='git commit -S -am'
|
|
||||||
|
|
||||||
# checkout
|
|
||||||
alias gcb='git checkout -b'
|
|
||||||
alias gco='git checkout'
|
|
||||||
alias gcob='git checkout -b'
|
|
||||||
alias gcobu='git checkout -b ${USER}/'
|
|
||||||
alias gcom='git checkout $(get_default_branch)'
|
|
||||||
alias gcpd='git checkout $(get_default_branch); git pull; git branch -D'
|
|
||||||
alias gct='git checkout --track'
|
|
||||||
|
|
||||||
# clone
|
|
||||||
alias gcl='git clone'
|
|
||||||
|
|
||||||
# clean
|
|
||||||
alias gclean='git clean -fd'
|
|
||||||
|
|
||||||
# cherry-pick
|
|
||||||
alias gcp='git cherry-pick'
|
|
||||||
alias gcpx='git cherry-pick -x'
|
|
||||||
|
|
||||||
# diff
|
|
||||||
alias gd='git diff'
|
|
||||||
alias gds='git diff --staged'
|
|
||||||
alias gdt='git difftool'
|
|
||||||
|
|
||||||
# archive
|
|
||||||
alias gexport='git archive --format zip --output'
|
|
||||||
|
|
||||||
# fetch
|
|
||||||
alias gf='git fetch --all --prune'
|
|
||||||
alias gft='git fetch --all --prune --tags'
|
|
||||||
alias gftv='git fetch --all --prune --tags --verbose'
|
|
||||||
alias gfv='git fetch --all --prune --verbose'
|
|
||||||
alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/$(get_default_branch)'
|
|
||||||
alias gup='git fetch && git rebase'
|
|
||||||
|
|
||||||
# log
|
|
||||||
alias gg='git log --graph --pretty=format:'\''%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset'\'' --abbrev-commit --date=relative'
|
|
||||||
alias ggf='git log --graph --date=short --pretty=format:'\''%C(auto)%h %Cgreen%an%Creset %Cblue%cd%Creset %C(auto)%d %s'\'''
|
|
||||||
alias ggs='gg --stat'
|
|
||||||
alias ggup='git log --branches --not --remotes --no-walk --decorate --oneline' # FROM https://stackoverflow.com/questions/39220870/in-git-list-names-of-branches-with-unpushed-commits
|
|
||||||
alias gll='git log --graph --pretty=oneline --abbrev-commit'
|
|
||||||
alias gnew='git log HEAD@{1}..HEAD@{0}' # Show commits since last pull, see http://blogs.atlassian.com/2014/10/advanced-git-aliases/
|
|
||||||
alias gwc='git whatchanged'
|
|
||||||
|
|
||||||
# ls-files
|
|
||||||
alias gu='git ls-files . --exclude-standard --others' # Show untracked files
|
|
||||||
alias glsut='gu'
|
|
||||||
alias glsum='git diff --name-only --diff-filter=U' # Show unmerged (conflicted) files
|
|
||||||
|
|
||||||
# gui
|
|
||||||
alias ggui='git gui'
|
|
||||||
|
|
||||||
# home
|
|
||||||
alias ghm='cd "$(git rev-parse --show-toplevel)"' # Git home
|
|
||||||
# appendage to ghm
|
|
||||||
if ! _command_exists gh; then
|
|
||||||
alias gh='ghm'
|
|
||||||
fi
|
|
||||||
|
|
||||||
# merge
|
|
||||||
alias gm='git merge'
|
|
||||||
|
|
||||||
# mv
|
|
||||||
alias gmv='git mv'
|
|
||||||
|
|
||||||
# patch
|
|
||||||
alias gpatch='git format-patch -1'
|
|
||||||
|
|
||||||
# push
|
|
||||||
alias gp='git push'
|
|
||||||
alias gpd='git push --delete'
|
|
||||||
alias gpf='git push --force'
|
|
||||||
alias gpo='git push origin HEAD'
|
|
||||||
alias gpom='git push origin $(get_default_branch)'
|
|
||||||
alias gpu='git push --set-upstream'
|
|
||||||
alias gpunch='git push --force-with-lease'
|
|
||||||
alias gpuo='git push --set-upstream origin'
|
|
||||||
alias gpuoc='git push --set-upstream origin $(git symbolic-ref --short HEAD)'
|
|
||||||
|
|
||||||
# pull
|
|
||||||
alias gl='git pull'
|
|
||||||
alias glum='git pull upstream $(get_default_branch)'
|
|
||||||
alias gpl='git pull'
|
|
||||||
alias gpp='git pull && git push'
|
|
||||||
alias gpr='git pull --rebase'
|
|
||||||
|
|
||||||
# remote
|
|
||||||
alias gr='git remote'
|
|
||||||
alias gra='git remote add'
|
|
||||||
alias grv='git remote -v'
|
|
||||||
|
|
||||||
# rm
|
|
||||||
alias grm='git rm'
|
|
||||||
|
|
||||||
# rebase
|
|
||||||
alias grb='git rebase'
|
|
||||||
alias grbc='git rebase --continue'
|
|
||||||
alias grm='git rebase $(get_default_branch)'
|
|
||||||
alias grmi='git rebase $(get_default_branch) -i'
|
|
||||||
alias gprom='git fetch origin $(get_default_branch) && git rebase origin/$(get_default_branch) && git update-ref refs/heads/$(get_default_branch) origin/$(get_default_branch)' # Rebase with latest remote
|
|
||||||
|
|
||||||
# reset
|
|
||||||
alias gus='git reset HEAD'
|
|
||||||
alias gpristine='git reset --hard && git clean -dfx'
|
|
||||||
|
|
||||||
# status
|
|
||||||
alias gs='git status'
|
|
||||||
alias gss='git status -s'
|
|
||||||
|
|
||||||
# shortlog
|
|
||||||
alias gcount='git shortlog -sn'
|
|
||||||
alias gsl='git shortlog -sn'
|
|
||||||
|
|
||||||
# show
|
|
||||||
alias gsh='git show'
|
|
||||||
|
|
||||||
# svn
|
|
||||||
alias gsd='git svn dcommit'
|
|
||||||
alias gsr='git svn rebase' # Git SVN
|
|
||||||
|
|
||||||
# stash
|
|
||||||
alias gst='git stash'
|
|
||||||
alias gstb='git stash branch'
|
|
||||||
alias gstd='git stash drop'
|
|
||||||
alias gstl='git stash list'
|
|
||||||
alias gstp='git stash pop' # kept due to long-standing usage
|
|
||||||
alias gstpo='git stash pop' # recommended for it's symmetry with gstpu (push)
|
|
||||||
|
|
||||||
## 'stash push' introduced in git v2.13.2
|
|
||||||
alias gstpu='git stash push'
|
|
||||||
alias gstpum='git stash push -m'
|
|
||||||
|
|
||||||
## 'stash save' deprecated since git v2.16.0, alias is now push
|
|
||||||
alias gsts='git stash push'
|
|
||||||
alias gstsm='git stash push -m'
|
|
||||||
|
|
||||||
# submodules
|
|
||||||
alias gsu='git submodule update --init --recursive'
|
|
||||||
|
|
||||||
# switch
|
|
||||||
# these aliases requires git v2.23+
|
|
||||||
alias gsw='git switch'
|
|
||||||
alias gswc='git switch --create'
|
|
||||||
alias gswm='git switch $(get_default_branch)'
|
|
||||||
alias gswt='git switch --track'
|
|
||||||
|
|
||||||
# tag
|
|
||||||
alias gt='git tag'
|
|
||||||
alias gta='git tag -a'
|
|
||||||
alias gtd='git tag -d'
|
|
||||||
alias gtl='git tag -l'
|
|
||||||
|
|
||||||
case $OSTYPE in
|
|
||||||
darwin*)
|
|
||||||
alias gtls="git tag -l | gsort -V"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
alias gtls='git tag -l | sort -V'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# functions
|
|
||||||
function gdv() {
|
|
||||||
git diff --ignore-all-space "$@" | vim -R -
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_default_branch() {
|
|
||||||
if git branch | grep -q main; then
|
|
||||||
echo main
|
|
||||||
else
|
|
||||||
echo master
|
|
||||||
fi
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'common git-svn abbreviations'
|
|
||||||
|
|
||||||
# Aliases
|
|
||||||
alias gsr='git svn rebase'
|
|
||||||
alias gsc='git svn dcommit'
|
|
||||||
alias gsi='git svn info'
|
|
|
@ -1,34 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'heroku task abbreviations'
|
|
||||||
|
|
||||||
# heroku
|
|
||||||
alias h='heroku'
|
|
||||||
alias hl='heroku list'
|
|
||||||
alias hi='heroku info'
|
|
||||||
alias ho='heroku open'
|
|
||||||
|
|
||||||
# dynos and workers
|
|
||||||
alias hd='heroku dynos'
|
|
||||||
alias hw='heroku workers'
|
|
||||||
|
|
||||||
# rake console
|
|
||||||
alias hr='heroku rake'
|
|
||||||
alias hcon='heroku console'
|
|
||||||
|
|
||||||
# new and restart
|
|
||||||
alias hnew='heroku create'
|
|
||||||
alias hrestart='heroku restart'
|
|
||||||
|
|
||||||
# logs
|
|
||||||
alias hlog='heroku logs'
|
|
||||||
alias hlogs='heroku logs'
|
|
||||||
|
|
||||||
# maint
|
|
||||||
alias hon='heroku maintenance:on'
|
|
||||||
alias hoff='heroku maintenance:off'
|
|
||||||
|
|
||||||
# heroku configs
|
|
||||||
alias hc='heroku config'
|
|
||||||
alias hca='heroku config:add'
|
|
||||||
alias hcr='heroku config:remove'
|
|
||||||
alias hcc='heroku config:clear'
|
|
|
@ -1,6 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'mercurial abbreviations'
|
|
||||||
|
|
||||||
alias hs='hg status'
|
|
||||||
alias hsum='hg summary'
|
|
||||||
alias hcm='hg commit -m'
|
|
|
@ -1,13 +0,0 @@
|
||||||
# Some aliases for Homebrew Cask
|
|
||||||
|
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'homebrew-cask abbreviations'
|
|
||||||
|
|
||||||
alias bcin='brew cask install'
|
|
||||||
alias bcrm='brew cask uninstall'
|
|
||||||
alias bczp='brew cask zap'
|
|
||||||
alias bccl='brew cask cleanup'
|
|
||||||
alias bcls='brew cask list'
|
|
||||||
alias bcinf='brew cask info'
|
|
||||||
alias bcdr='brew cask doctor'
|
|
||||||
alias bced='brew cask edit'
|
|
|
@ -1,15 +0,0 @@
|
||||||
# Some aliases for Homebrew
|
|
||||||
|
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'homebrew abbreviations'
|
|
||||||
|
|
||||||
alias bup='brew update && brew upgrade'
|
|
||||||
alias bout='brew outdated'
|
|
||||||
alias bin='brew install'
|
|
||||||
alias brm='brew uninstall'
|
|
||||||
alias bcl='brew cleanup'
|
|
||||||
alias bls='brew list'
|
|
||||||
alias bsr='brew search'
|
|
||||||
alias binf='brew info'
|
|
||||||
alias bdr='brew doctor'
|
|
||||||
alias bed='brew edit'
|
|
|
@ -1,24 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'homesick aliases'
|
|
||||||
|
|
||||||
# Aliases
|
|
||||||
alias sikhm="homesick cd dotfiles"
|
|
||||||
alias sikclone="homesick clone"
|
|
||||||
alias sikcomt="homesick commit dotfiles"
|
|
||||||
alias sikdstry="homesick destroy"
|
|
||||||
alias sikdif="homesick diff dotfiles"
|
|
||||||
alias sikexec="homesick exec dotfiles"
|
|
||||||
alias sikexeca="homesick exec_all"
|
|
||||||
alias sikgen="homesick generate"
|
|
||||||
alias sikhlp="homesick help"
|
|
||||||
alias siklnk="homesick link dotfiles"
|
|
||||||
alias sikls="homesick list"
|
|
||||||
alias sikopn="homesick open dotfiles"
|
|
||||||
alias sikpll="homesick pull dotfiles"
|
|
||||||
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"
|
|
|
@ -1,49 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'jitsu task abbreviations'
|
|
||||||
|
|
||||||
# jitsu
|
|
||||||
alias j='jitsu'
|
|
||||||
alias jl='jitsu login'
|
|
||||||
alias jo='jitsu logout'
|
|
||||||
|
|
||||||
# deploy and update
|
|
||||||
alias jd='jitsu apps deploy'
|
|
||||||
alias ju='jitsu apps update'
|
|
||||||
|
|
||||||
# new and start, restart, stop
|
|
||||||
alias jn='jitsu apps create'
|
|
||||||
alias js='jitsu apps start'
|
|
||||||
alias jr='jitsu apps restart'
|
|
||||||
alias jx='jitsu apps stop'
|
|
||||||
|
|
||||||
# logs
|
|
||||||
alias jll='jitsu logs'
|
|
||||||
alias jlog='jitsu logs'
|
|
||||||
alias jlogs='jitsu logs'
|
|
||||||
|
|
||||||
# env
|
|
||||||
alias je='jitsu env'
|
|
||||||
alias jel='jitsu env list'
|
|
||||||
alias jes='jitsu env set'
|
|
||||||
alias jeg='jitsu env get'
|
|
||||||
alias jed='jitsu env delete'
|
|
||||||
alias jec='jitsu env clear'
|
|
||||||
alias jesv='jitsu env save'
|
|
||||||
alias jeld='jitsu env load'
|
|
||||||
|
|
||||||
# configuration
|
|
||||||
alias jc='jitsu conf'
|
|
||||||
alias jcl='jitsu config list'
|
|
||||||
alias jcs='jitsu config set'
|
|
||||||
alias jcg='jitsu config get'
|
|
||||||
alias jcd='jitsu config delete'
|
|
||||||
|
|
||||||
# list and install, view
|
|
||||||
alias jls='jitsu list'
|
|
||||||
alias jin='jitsu install'
|
|
||||||
alias jv='jitsu apps view'
|
|
||||||
|
|
||||||
# Database, Snapshots and Tokens
|
|
||||||
alias jdb='jitsu databases'
|
|
||||||
alias jss='jitsu snapshots'
|
|
||||||
alias jto='jitsu tokens'
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# -binaryanomaly
|
|
||||||
|
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'kubectl aliases'
|
|
||||||
|
|
||||||
function _set_pkg_aliases()
|
|
||||||
{
|
|
||||||
if _command_exists kubectl; then
|
|
||||||
alias kc='kubectl'
|
|
||||||
alias kcgp='kubectl get pods'
|
|
||||||
alias kcgd='kubectl get deployments'
|
|
||||||
alias kcgn='kubectl get nodes'
|
|
||||||
alias kcdp='kubectl describe pod'
|
|
||||||
alias kcdd='kubectl describe deployment'
|
|
||||||
alias kcdn='kubectl describe node'
|
|
||||||
alias kcgpan='kubectl get pods --all-namespaces'
|
|
||||||
alias kcgdan='kubectl get deployments --all-namespaces'
|
|
||||||
# launches a disposable netshoot pod in the k8s cluster
|
|
||||||
alias kcnetshoot='kubectl run netshoot-$(date +%s) --rm -i --tty --image nicolaka/netshoot -- /bin/bash'
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
_set_pkg_aliases
|
|
|
@ -1,74 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'laravel artisan abbreviations'
|
|
||||||
|
|
||||||
# A list of useful laravel aliases
|
|
||||||
|
|
||||||
alias laravel="${HOME}/.composer/vendor/bin/laravel"
|
|
||||||
# asset
|
|
||||||
alias a:apub='php artisan asset:publish'
|
|
||||||
|
|
||||||
# auth
|
|
||||||
alias a:remclear='php artisan auth:clear-reminders'
|
|
||||||
alias a:remcontroller='php artisan auth:reminders-controller'
|
|
||||||
alias a:remtable='php artisan auth:reminders-table'
|
|
||||||
|
|
||||||
# cache
|
|
||||||
alias a:cacheclear='php artisan cache:clear'
|
|
||||||
|
|
||||||
# command
|
|
||||||
alias a:command='php artisan command:make'
|
|
||||||
|
|
||||||
# config
|
|
||||||
alias a:confpub='php artisan config:publish'
|
|
||||||
|
|
||||||
# controller
|
|
||||||
alias a:controller='php artisan make:controller'
|
|
||||||
|
|
||||||
# db
|
|
||||||
alias a:seed='php artisan db:seed'
|
|
||||||
|
|
||||||
# key
|
|
||||||
alias a:key='php artisan key:generate'
|
|
||||||
|
|
||||||
# migrate
|
|
||||||
alias a:migrate='php artisan migrate'
|
|
||||||
alias a:mig='a:migrate'
|
|
||||||
alias a:miginstall='php artisan migrate:install'
|
|
||||||
alias a:migmake='php artisan migrate:make'
|
|
||||||
alias a:migcreate='php artisan migrate:create'
|
|
||||||
alias a:migpublish='php artisan migrate:publish'
|
|
||||||
alias a:migrefresh='php artisan migrate:refresh'
|
|
||||||
alias a:migreset='php artisan migrate:reset'
|
|
||||||
alias a:migrollback='php artisan migrate:rollback'
|
|
||||||
alias a:rollback='a:migrollback'
|
|
||||||
|
|
||||||
# queue
|
|
||||||
alias a:qfailed='php artisan queue:failed'
|
|
||||||
alias a:qfailedtable='php artisan queue:failed-table'
|
|
||||||
alias a:qflush='php artisan queue:flush'
|
|
||||||
alias a:qforget='php artisan queue:forget'
|
|
||||||
alias a:qlisten='php artisan queue:listen'
|
|
||||||
alias a:qretry='php artisan queue:retry'
|
|
||||||
alias a:qsubscribe='php artisan queue:subscribe'
|
|
||||||
alias a:qwork='php artisan queue:work'
|
|
||||||
|
|
||||||
# session
|
|
||||||
alias a:stable='php artisan session:table'
|
|
||||||
|
|
||||||
# view
|
|
||||||
alias a:vpub='php artisan view:publish'
|
|
||||||
|
|
||||||
# misc
|
|
||||||
alias a:='php artisan'
|
|
||||||
alias a:changes='php artisan changes'
|
|
||||||
alias a:down='php artisan down'
|
|
||||||
alias a:env='php artisan env'
|
|
||||||
alias a:help='php artisan help'
|
|
||||||
alias a:list='php artisan list'
|
|
||||||
alias a:optimize='php artisan optimize'
|
|
||||||
alias a:routes='php artisan routes'
|
|
||||||
alias a:serve='php artisan serve'
|
|
||||||
alias a:tail='php artisan tail'
|
|
||||||
alias a:tinker='php artisan tinker'
|
|
||||||
alias a:up='php artisan up'
|
|
||||||
alias a:work='php artisan workbench'
|
|
|
@ -1,14 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'maven abbreviations'
|
|
||||||
|
|
||||||
alias mci='mvn clean install'
|
|
||||||
alias mi='mvn install'
|
|
||||||
alias mcp='mvn clean package'
|
|
||||||
alias mp='mvn package'
|
|
||||||
alias mrprep='mvn release:prepare'
|
|
||||||
alias mrperf='mvn release:perform'
|
|
||||||
alias mrrb='mvn release:rollback'
|
|
||||||
alias mdep='mvn dependency:tree'
|
|
||||||
alias mpom='mvn help:effective-pom'
|
|
||||||
alias mcisk='mci -Dmaven.test.skip=true'
|
|
||||||
alias mcpsk='mcp -Dmaven.test.skip=true'
|
|
|
@ -1,15 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'MSYS2 aliases'
|
|
||||||
|
|
||||||
LS_COMMON="-hG"
|
|
||||||
LS_COMMON="$LS_COMMON --color=auto"
|
|
||||||
LS_COMMON="$LS_COMMON -I NTUSER.DAT\* -I ntuser.dat\*"
|
|
||||||
|
|
||||||
# alias
|
|
||||||
# setup the main ls alias if we've established common args
|
|
||||||
test -n "$LS_COMMON" && alias ls="command ls $LS_COMMON"
|
|
||||||
alias ll="ls -l"
|
|
||||||
alias la="ls -a"
|
|
||||||
alias lal="ll -a"
|
|
|
@ -1,8 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'the Node.js environment aliases'
|
|
||||||
|
|
||||||
# alias to setup nodejs development environment
|
|
||||||
alias node-dev='export NODE_ENV=development'
|
|
||||||
|
|
||||||
# alias to setup nodejs production environment
|
|
||||||
alias node-prod='export NODE_ENV=production'
|
|
|
@ -1,43 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'common npm abbreviations'
|
|
||||||
|
|
||||||
# Aliases
|
|
||||||
|
|
||||||
# npm
|
|
||||||
alias ni='npm install'
|
|
||||||
alias nis='npm install --save'
|
|
||||||
alias nid='npm install --save-dev'
|
|
||||||
alias nit='npm install-test'
|
|
||||||
alias nits='npm install-test --save'
|
|
||||||
alias nitd='npm install-test --save-dev'
|
|
||||||
alias nu='npm uninstall'
|
|
||||||
alias nus='npm uninstall --save'
|
|
||||||
alias nusd='npm uninstall --save-dev'
|
|
||||||
alias np='npm publish'
|
|
||||||
alias nup='npm unpublish'
|
|
||||||
alias nlk='npm link'
|
|
||||||
alias nod='npm outdated'
|
|
||||||
alias nrb='npm rebuild'
|
|
||||||
alias nud='npm update'
|
|
||||||
alias nr='npm run'
|
|
||||||
alias nls='npm list --depth=0 2>/dev/null'
|
|
||||||
alias nlsg='npm list -g --depth=0 2>/dev/null'
|
|
||||||
alias nt='npm test'
|
|
||||||
|
|
||||||
# npx
|
|
||||||
alias nx='npx'
|
|
||||||
alias nxplease='npx $(fc -ln -1)'
|
|
||||||
alias nxn='npx --no-install '
|
|
||||||
alias nxp='npx -p '
|
|
||||||
alias nxnp='npx --no-install -p '
|
|
||||||
alias nxq='npx -q '
|
|
||||||
alias nxnq='npx --no-install -q '
|
|
||||||
alias nxqp='npx -q -p '
|
|
||||||
alias nxnqp='npx --no-install -q -p '
|
|
||||||
alias nxni='npx --no-install --ignore-existing '
|
|
||||||
alias nxip='npx --ignore-existing -p '
|
|
||||||
alias nxnip='npx --no-install --ignore-existing -p '
|
|
||||||
alias nxqi='npx -q --ignore-existing '
|
|
||||||
alias nxniq='npx --no-install --ignore-existing -q '
|
|
||||||
alias nxiqp='npx --ignore-existing -q -p '
|
|
||||||
alias nxniqp='npx --no-install --ignore-existing -q -p '
|
|
|
@ -1,55 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'osx-specific aliases'
|
|
||||||
|
|
||||||
# Desktop Programs
|
|
||||||
alias fireworks="open -a '/Applications/Adobe Fireworks CS3/Adobe Fireworks CS3.app'"
|
|
||||||
alias photoshop="open -a '/Applications/Adobe Photoshop CS3/Adobe Photoshop.app'"
|
|
||||||
alias preview="open -a '$PREVIEW'"
|
|
||||||
alias xcode="open -a '/Applications/XCode.app'"
|
|
||||||
alias filemerge="open -a '/Developer/Applications/Utilities/FileMerge.app'"
|
|
||||||
alias safari="open -a safari"
|
|
||||||
alias firefox="open -a firefox"
|
|
||||||
alias chrome="open -a google\ chrome"
|
|
||||||
alias chromium="open -a chromium"
|
|
||||||
alias dashcode="open -a dashcode"
|
|
||||||
alias f='open -a Finder '
|
|
||||||
alias fh='open -a Finder .'
|
|
||||||
alias textedit='open -a TextEdit'
|
|
||||||
alias hex='open -a "Hex Fiend"'
|
|
||||||
alias skype='open -a Skype'
|
|
||||||
alias mou='open -a Mou'
|
|
||||||
alias subl='open -a Sublime\ Text'
|
|
||||||
|
|
||||||
if [ -s /usr/bin/firefox ] ; then
|
|
||||||
unalias firefox
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Requires growlnotify, which can be found in the Growl DMG under "Extras"
|
|
||||||
alias grnot='growlnotify -s -t Terminal -m "Done"'
|
|
||||||
|
|
||||||
# Get rid of those pesky .DS_Store files recursively
|
|
||||||
alias dsclean='find . -type f -name .DS_Store -delete'
|
|
||||||
|
|
||||||
# Track who is listening to your iTunes music
|
|
||||||
alias whotunes='lsof -r 2 -n -P -F n -c iTunes -a -i TCP@`hostname`:3689'
|
|
||||||
|
|
||||||
# Flush your dns cache
|
|
||||||
alias flush='dscacheutil -flushcache'
|
|
||||||
|
|
||||||
# Show/hide hidden files (for Mac OS X Mavericks)
|
|
||||||
alias showhidden="defaults write com.apple.finder AppleShowAllFiles TRUE"
|
|
||||||
alias hidehidden="defaults write com.apple.finder AppleShowAllFiles FALSE"
|
|
||||||
|
|
||||||
# From http://apple.stackexchange.com/questions/110343/copy-last-command-in-terminal
|
|
||||||
alias copyLastCmd='fc -ln -1 | awk '\''{$1=$1}1'\'' ORS='\'''\'' | pbcopy'
|
|
||||||
|
|
||||||
# Use Finder's Quick Look on a file (^C or space to close)
|
|
||||||
alias ql='qlmanage -p 2>/dev/null'
|
|
||||||
|
|
||||||
# Mute/Unmute the system volume. Plays nice with all other volume settings.
|
|
||||||
alias mute="osascript -e 'set volume output muted true'"
|
|
||||||
alias unmute="osascript -e 'set volume output muted false'"
|
|
||||||
|
|
||||||
# Pin to the tail of long commands for an audible alert after long processes
|
|
||||||
## curl http://downloads.com/hugefile.zip; lmk
|
|
||||||
alias lmk="say 'Process complete.'"
|
|
|
@ -1,49 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'phoenix abbreviations'
|
|
||||||
|
|
||||||
# Phoenix Commands
|
|
||||||
alias i='iex'
|
|
||||||
alias ips='iex -S mix phx.server'
|
|
||||||
alias ism='iex -S mix'
|
|
||||||
alias m='mix'
|
|
||||||
alias mab='mix archive.build'
|
|
||||||
alias mai='mix archive.install'
|
|
||||||
alias mat='mix app.tree'
|
|
||||||
alias mc='mix compile'
|
|
||||||
alias mcv='mix compile --verbose'
|
|
||||||
alias mcx='mix compile.xref'
|
|
||||||
alias mdc='mix deps.compile'
|
|
||||||
alias mdg='mix deps.get'
|
|
||||||
alias mdgc='mix do deps.get, deps.compile'
|
|
||||||
alias mdu='mix deps.update'
|
|
||||||
alias mdt='mix deps.tree'
|
|
||||||
alias mdua='mix deps.update --all'
|
|
||||||
alias mdun='mix deps.unlock'
|
|
||||||
alias mduu='mix deps.unlock --unused'
|
|
||||||
alias meb='mix escript.build'
|
|
||||||
alias mec='mix ecto.create'
|
|
||||||
alias mecm='mix do ecto.create, ecto.migrate'
|
|
||||||
alias med='mix ecto.drop'
|
|
||||||
alias mem='mix ecto.migrate'
|
|
||||||
alias megm='mix ecto.gen.migration'
|
|
||||||
alias merb='mix ecto.rollback'
|
|
||||||
alias mers='mix ecto.reset'
|
|
||||||
alias mho='mix hex.outdated'
|
|
||||||
alias mlh='mix local.hex'
|
|
||||||
alias mn='mix new'
|
|
||||||
alias mns='mix new --sup'
|
|
||||||
alias mpgc='mix phx.gen.channel'
|
|
||||||
alias mpgh='mix phx.gen.html'
|
|
||||||
alias mpgj='mix phx.gen.json'
|
|
||||||
alias mpgm='mix phx.gen.model'
|
|
||||||
alias mpgs='mix phx.gen.secret'
|
|
||||||
alias mpn='mix phx.new'
|
|
||||||
alias mpr='mix phx.routes'
|
|
||||||
alias mps='mix phx.server'
|
|
||||||
alias mr='mix run'
|
|
||||||
alias mrnh='mix run --no-halt'
|
|
||||||
alias mrl='mix release'
|
|
||||||
alias mt='mix test'
|
|
||||||
alias mts='mix test --stale'
|
|
||||||
alias mtw='mix test.watch'
|
|
||||||
alias mx='mix xref'
|
|
|
@ -1,9 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'puppet aliases'
|
|
||||||
|
|
||||||
# Aliases
|
|
||||||
alias pupval="puppet parser validate *.pp"
|
|
||||||
alias puplint="puppet-lint *.pp"
|
|
||||||
alias pupagt="puppet agent -t"
|
|
||||||
alias pupagtd="puppet agent -t --debug"
|
|
||||||
alias pupapp="puppet apply"
|
|
|
@ -1,152 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'pyrocms abbreviations'
|
|
||||||
|
|
||||||
###
|
|
||||||
## PyroCMS 3.4 bash aliases
|
|
||||||
## @author Denis Efremov <efremov.a.denis@gmail.com>
|
|
||||||
###
|
|
||||||
|
|
||||||
# general
|
|
||||||
alias a:cl="php artisan clear-compiled" # Remove the compiled class file
|
|
||||||
alias a:d="php artisan down" # Put the application into maintenance mode
|
|
||||||
alias a:e="php artisan env" # Display the current framework environment
|
|
||||||
alias a:h="php artisan help" # Displays help for a command
|
|
||||||
alias a:i="php artisan install" # Install the Streams Platform.
|
|
||||||
alias a:ls="php artisan list" # Lists commands
|
|
||||||
alias a:mg="php artisan migrate" # Run the database migrations
|
|
||||||
alias a:op="php artisan optimize" # Optimize the framework for better performance (deprecated)
|
|
||||||
alias a:pr="php artisan preset" # Swap the front-end scaffolding for the application
|
|
||||||
alias a:s="php artisan serve" # Serve the application on the PHP development server
|
|
||||||
alias a:u="php artisan up" # Bring the application out of maintenance mode
|
|
||||||
|
|
||||||
# addon
|
|
||||||
alias a:ad:i="php artisan addon:install" # Install an addon.
|
|
||||||
alias a:ad:p="php artisan addon:publish" # Publish an the configuration and translations for an addon.
|
|
||||||
alias a:ad:r="php artisan addon:reinstall" # Reinstall an addon.
|
|
||||||
alias a:ad:u="php artisan addon:uninstall" # Uninstall an addon.
|
|
||||||
|
|
||||||
# app
|
|
||||||
alias a:ap:n="php artisan app:name" # Set the application namespace
|
|
||||||
alias a:ap:p="php artisan app:publish" # Publish general application override files.
|
|
||||||
|
|
||||||
# assets
|
|
||||||
alias a:as:cl="php artisan assets:clear" # Clear compiled public assets.
|
|
||||||
|
|
||||||
# auth
|
|
||||||
alias a:au:clrs="php artisan auth:clear-resets" # Flush expired password reset tokens
|
|
||||||
|
|
||||||
# cache
|
|
||||||
alias a:ca:cl="php artisan cache:clear" # Flush the application cache
|
|
||||||
alias a:ca:f="php artisan cache:forget" # Remove an item from the cache
|
|
||||||
alias a:ca:t="php artisan cache:table" # Create a migration for the cache database table
|
|
||||||
|
|
||||||
# config
|
|
||||||
alias a:co:ca="php artisan config:cache" # Create a cache file for faster configuration loading
|
|
||||||
alias a:co:cl="php artisan config:clear" # Remove the configuration cache file
|
|
||||||
|
|
||||||
# db
|
|
||||||
alias a:db:s="php artisan db:seed" # Seed the database with records
|
|
||||||
|
|
||||||
# env
|
|
||||||
alias a:en:s="php artisan env:set" # Set an environmental value.
|
|
||||||
|
|
||||||
# event
|
|
||||||
alias a:ev:g="php artisan event:generate" # Generate the missing events and listeners based on registration
|
|
||||||
|
|
||||||
# extension
|
|
||||||
alias a:ex:i="php artisan extension:install" # Install a extension.
|
|
||||||
alias a:ex:r="php artisan extension:reinstall" # Reinstall a extension.
|
|
||||||
alias a:ex:u="php artisan extension:uninstall" # Uninstall a extension.
|
|
||||||
|
|
||||||
# files
|
|
||||||
alias a:fi:cl="php artisan files:clean" # Clean missing files from the files table.
|
|
||||||
|
|
||||||
# key
|
|
||||||
alias a:ke:g="php artisan key:generate" # Set the application key
|
|
||||||
|
|
||||||
# make
|
|
||||||
alias a:mk:ad="php artisan make:addon" # Create a new addon.
|
|
||||||
alias a:mk:au="php artisan make:auth" # Scaffold basic login and registration views and routes
|
|
||||||
alias a:mk:cm="php artisan make:command" # Create a new Artisan command
|
|
||||||
alias a:mk:ct="php artisan make:controller" # Create a new controller class
|
|
||||||
alias a:mk:ev="php artisan make:event" # Create a new event class
|
|
||||||
alias a:mk:fa="php artisan make:factory" # Create a new model factory
|
|
||||||
alias a:mk:j="php artisan make:job" # Create a new job class
|
|
||||||
alias a:mk:li="php artisan make:listener" # Create a new event listener class
|
|
||||||
alias a:mk:ma="php artisan make:mail" # Create a new email class
|
|
||||||
alias a:mk:mw="php artisan make:middleware" # Create a new middleware class
|
|
||||||
alias a:mk:mg="php artisan make:migration" # Create a new migration file
|
|
||||||
alias a:mk:md="php artisan make:model" # Create a new Eloquent model class
|
|
||||||
alias a:mk:no="php artisan make:notification" # Create a new notification class
|
|
||||||
alias a:mk:po="php artisan make:policy" # Create a new policy class
|
|
||||||
alias a:mk:pr="php artisan make:provider" # Create a new service provider class
|
|
||||||
alias a:mk:rq="php artisan make:request" # Create a new form request class
|
|
||||||
alias a:mk:rs="php artisan make:resource" # Create a new resource
|
|
||||||
alias a:mk:rl="php artisan make:rule" # Create a new validation rule
|
|
||||||
alias a:mk:sd="php artisan make:seeder" # Create a new seeder class
|
|
||||||
alias a:mk:st="php artisan make:stream" # Make a streams entity namespace.
|
|
||||||
alias a:mk:ts="php artisan make:test" # Create a new test class
|
|
||||||
|
|
||||||
# migrate
|
|
||||||
alias a:mg:fr="php artisan migrate:fresh" # Drop all tables and re-run all migrations
|
|
||||||
alias a:mg:i="php artisan migrate:install" # Create the migration repository
|
|
||||||
alias a:mg:rf="php artisan migrate:refresh" # Reset and re-run all migrations
|
|
||||||
alias a:mg:rs="php artisan migrate:reset" # Rollback all database migrations
|
|
||||||
alias a:mg:rl="php artisan migrate:rollback" # Rollback the last database migration
|
|
||||||
alias a:mg:st="php artisan migrate:status" # Show the status of each migration
|
|
||||||
|
|
||||||
# module
|
|
||||||
alias a:mo:i="php artisan module:install" # Install a module.
|
|
||||||
alias a:mo:r="php artisan module:reinstall" # Reinstall a module.
|
|
||||||
alias a:mo:u="php artisan module:uninstall" # Uninstall a module.
|
|
||||||
|
|
||||||
# notifications
|
|
||||||
alias a:no:tb="php artisan notifications:table" # Create a migration for the notifications table
|
|
||||||
|
|
||||||
# package
|
|
||||||
alias a:pk:d="php artisan package:discover" # Rebuild the cached package manifest
|
|
||||||
|
|
||||||
# queue
|
|
||||||
alias a:qu:fa="php artisan queue:failed" # List all of the failed queue jobs
|
|
||||||
alias a:qu:ft="php artisan queue:failed-table" # Create a migration for the failed queue jobs database table
|
|
||||||
alias a:qu:fl="php artisan queue:flush" # Flush all of the failed queue jobs
|
|
||||||
alias a:qu:fg="php artisan queue:forget" # Delete a failed queue job
|
|
||||||
alias a:qu:li="php artisan queue:listen" # Listen to a given queue
|
|
||||||
alias a:qu:rs="php artisan queue:restart" # Restart queue worker daemons after their current job
|
|
||||||
alias a:qu:rt="php artisan queue:retry" # Retry a failed queue job
|
|
||||||
alias a:qu:tb="php artisan queue:table" # Create a migration for the queue jobs database table
|
|
||||||
alias a:qu:w="php artisan queue:work" # Start processing jobs on the queue as a daemon
|
|
||||||
|
|
||||||
# route
|
|
||||||
alias a:ro:ca="php artisan route:cache" # Create a route cache file for faster route registration
|
|
||||||
alias a:ro:cl="php artisan route:clear" # Remove the route cache file
|
|
||||||
alias a:ro:ls="php artisan route:list" # List all registered routes
|
|
||||||
|
|
||||||
# schedule
|
|
||||||
alias a:sc:r="php artisan schedule:run" # Run the scheduled commands
|
|
||||||
|
|
||||||
# scout
|
|
||||||
alias a:su:fl="php artisan scout:flush" # Flush all of the model's records from the index
|
|
||||||
alias a:su:im="php artisan scout:import" # Import the given model into the search index
|
|
||||||
|
|
||||||
# session
|
|
||||||
alias a:se:tb="php artisan session:table" # Create a migration for the session database table
|
|
||||||
|
|
||||||
# storage
|
|
||||||
alias a:sg:l="php artisan storage:link" # Create a symbolic link from "public/storage" to "storage/app/public"
|
|
||||||
|
|
||||||
# streams
|
|
||||||
alias a:st:cl="php artisan streams:cleanup" # Cleanup streams entry models.
|
|
||||||
alias a:st:co="php artisan streams:compile" # Compile streams entry models.
|
|
||||||
alias a:st:d="php artisan streams:destroy" # Destroy a namespace.
|
|
||||||
alias a:st:p="php artisan streams:publish" # Publish configuration and translations for streams.
|
|
||||||
alias a:st:r="php artisan streams:refresh" # Refresh streams generated components.
|
|
||||||
|
|
||||||
# tntsearch
|
|
||||||
alias a:tn:im="php artisan tntsearch:import" # Import the given model into the search index
|
|
||||||
|
|
||||||
# vendor
|
|
||||||
alias a:ve:p="php artisan vendor:publish" # Publish any publishable assets from vendor packages
|
|
||||||
|
|
||||||
# view
|
|
||||||
alias a:vi:cl="php artisan view:clear" # Clear all compiled view files
|
|
|
@ -1,22 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'rails abbreviations'
|
|
||||||
|
|
||||||
# Rails Commands
|
|
||||||
alias r='rails'
|
|
||||||
alias rg='rails g'
|
|
||||||
alias rs='rails s'
|
|
||||||
alias rc='rails c'
|
|
||||||
alias rn='rails new'
|
|
||||||
alias rb='rails dbconsole'
|
|
||||||
alias rp='rails plugin'
|
|
||||||
alias ra='rails application'
|
|
||||||
alias rd='rails destroy'
|
|
||||||
alias dbm='rake db:migrate'
|
|
||||||
|
|
||||||
alias ss='script/server'
|
|
||||||
alias ts="thin start" # thin server
|
|
||||||
alias sc='script/console'
|
|
||||||
alias restartapp='touch tmp/restart.txt'
|
|
||||||
alias restart='touch tmp/restart.txt' # restart passenger
|
|
||||||
alias devlog='tail -f log/development.log'
|
|
||||||
alias taild='tail -f log/development.log' # tail dev log
|
|
|
@ -1,15 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'common svn abbreviations'
|
|
||||||
|
|
||||||
# Aliases
|
|
||||||
alias svs='svn status'
|
|
||||||
alias sa='svn add'
|
|
||||||
alias sci='svn ci -m'
|
|
||||||
alias sco='svn co'
|
|
||||||
alias sup='svn up'
|
|
||||||
alias scu='svn cleanup'
|
|
||||||
alias sli='svn list'
|
|
||||||
alias sdel='svn delete'
|
|
||||||
alias sdif='svn diff'
|
|
||||||
alias slog='svn log'
|
|
||||||
alias smv='svn move'
|
|
|
@ -1,22 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'systemd service'
|
|
||||||
|
|
||||||
case $OSTYPE in
|
|
||||||
linux*)
|
|
||||||
# Improve aliases by bringing the common root `sc|scd` + `sre` for action + `u` for user
|
|
||||||
alias sc='systemctl'
|
|
||||||
alias scu='systemctl --user'
|
|
||||||
alias scdr='systemctl daemon-reload'
|
|
||||||
alias scdru='systemctl --user daemon-reload'
|
|
||||||
alias scr='systemctl restart'
|
|
||||||
alias scru='systemctl --user restart'
|
|
||||||
alias sce='systemctl stop'
|
|
||||||
alias sceu='systemctl --user stop'
|
|
||||||
alias scs='systemctl start'
|
|
||||||
alias scsu='systemctl --user start'
|
|
||||||
# Keeping previous aliases for a non-breaking change.
|
|
||||||
alias scue='sceu'
|
|
||||||
alias scus='scsu'
|
|
||||||
alias scur='scdru'
|
|
||||||
;;
|
|
||||||
esac
|
|
|
@ -1,10 +0,0 @@
|
||||||
# Aliases for Terraform and Terragrunt
|
|
||||||
|
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'Terraform abbreviations'
|
|
||||||
|
|
||||||
alias tf='terraform'
|
|
||||||
alias tfv='terraform validate'
|
|
||||||
alias tfp='terraform plan'
|
|
||||||
alias tfa='terraform apply'
|
|
||||||
alias tfd='terraform destroy'
|
|
|
@ -1,15 +0,0 @@
|
||||||
# Aliases for Terraform and Terragrunt
|
|
||||||
|
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'Terragrunt abbreviations'
|
|
||||||
|
|
||||||
alias tg='terragrunt'
|
|
||||||
alias tgv='terragrunt validate'
|
|
||||||
alias tgp='terragrunt plan'
|
|
||||||
alias tga='terragrunt apply'
|
|
||||||
alias tgd='terragrunt destroy'
|
|
||||||
|
|
||||||
alias tgva='terragrunt validate-all'
|
|
||||||
alias tgpa='terragrunt plan-all'
|
|
||||||
alias tgaa='terragrunt apply-all'
|
|
||||||
alias tgda='terragrunt destroy-all'
|
|
|
@ -1,10 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'textmate abbreviations'
|
|
||||||
|
|
||||||
case $OSTYPE in
|
|
||||||
darwin*)
|
|
||||||
# Textmate
|
|
||||||
alias e='mate . &'
|
|
||||||
alias et='mate app config db lib public script test spec config.ru Gemfile Rakefile README &'
|
|
||||||
;;
|
|
||||||
esac
|
|
|
@ -1,6 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'Tmux terminal multiplexer'
|
|
||||||
|
|
||||||
alias txl='tmux ls'
|
|
||||||
alias txn='tmux new -s'
|
|
||||||
alias txa='tmux a -t'
|
|
|
@ -1,8 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'todo.txt-cli abbreviations'
|
|
||||||
|
|
||||||
alias tls="$TODO ls"
|
|
||||||
alias ta="$TODO a"
|
|
||||||
alias trm="$TODO rm"
|
|
||||||
alias tdo="$TODO do"
|
|
||||||
alias tpri="$TODO pri"
|
|
|
@ -1,11 +0,0 @@
|
||||||
cite 'uuid-alias'
|
|
||||||
about-alias 'uuidgen aliases'
|
|
||||||
|
|
||||||
if _command_exists uuid; then # Linux
|
|
||||||
alias uuidu="uuid | tr '[:lower:]' '[:upper:]'"
|
|
||||||
alias uuidl=uuid
|
|
||||||
elif _command_exists uuidgen; then # macOS/BSD
|
|
||||||
alias uuidu="uuidgen"
|
|
||||||
alias uuid="uuidgen | tr '[:upper:]' '[:lower:]'" # because upper case is like YELLING
|
|
||||||
alias uuidl=uuid
|
|
||||||
fi
|
|
|
@ -1,22 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'vagrant aliases'
|
|
||||||
|
|
||||||
# Aliases
|
|
||||||
alias vhl='vagrant hosts list'
|
|
||||||
alias vscp='vagrant scp'
|
|
||||||
alias vsl='vagrant snapshot list'
|
|
||||||
alias vst='vagrant snapshot take'
|
|
||||||
alias vup="vagrant up"
|
|
||||||
alias vupl="vagrant up 2>&1 | tee vagrant.log"
|
|
||||||
alias vh="vagrant halt"
|
|
||||||
alias vs="vagrant suspend"
|
|
||||||
alias vr="vagrant resume"
|
|
||||||
alias vrl="vagrant reload"
|
|
||||||
alias vssh="vagrant ssh"
|
|
||||||
alias vst="vagrant status"
|
|
||||||
alias vp="vagrant provision"
|
|
||||||
alias vdstr="vagrant destroy"
|
|
||||||
# requires vagrant-list plugin
|
|
||||||
alias vl="vagrant list"
|
|
||||||
# requires vagrant-hostmanager plugin
|
|
||||||
alias vhst="vagrant hostmanager"
|
|
|
@ -1,15 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'vault aliases'
|
|
||||||
|
|
||||||
# Aliases
|
|
||||||
alias vad="vault delete"
|
|
||||||
alias val="vault list"
|
|
||||||
alias var="vault read"
|
|
||||||
alias varn="vault renew"
|
|
||||||
alias varv="vault revoke"
|
|
||||||
alias vasrv="vault server"
|
|
||||||
alias vas="vault status"
|
|
||||||
alias vav="vault version"
|
|
||||||
alias vaw="vault write"
|
|
||||||
alias vag="vault login -method=github"
|
|
||||||
alias varv="vault read -field=value"
|
|
|
@ -1,25 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'vim abbreviations'
|
|
||||||
|
|
||||||
VIM=$(command -v vim)
|
|
||||||
GVIM=$(command -v gvim)
|
|
||||||
MVIM=$(command -v mvim)
|
|
||||||
|
|
||||||
if [[ -n $VIM ]]; then
|
|
||||||
alias v='$VIM'
|
|
||||||
# open the vim help in fullscreen incorporated from
|
|
||||||
# https://stackoverflow.com/a/4687513
|
|
||||||
alias vimh='${VIM} -c ":h | only"'
|
|
||||||
fi
|
|
||||||
|
|
||||||
# open vim in new tab is taken from
|
|
||||||
# http://stackoverflow.com/questions/936501/let-gvim-always-run-a-single-instancek
|
|
||||||
case $OSTYPE in
|
|
||||||
darwin*)
|
|
||||||
[[ -n $MVIM ]] && function mvimt { command mvim --remote-tab-silent "$@" || command mvim "$@"; }
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
[[ -n $GVIM ]] && function gvimt { command gvim --remote-tab-silent "$@" || command gvim "$@"; }
|
|
||||||
;;
|
|
||||||
esac
|
|
|
@ -1,26 +0,0 @@
|
||||||
cite 'about-alias'
|
|
||||||
about-alias 'yarn package manager aliases'
|
|
||||||
|
|
||||||
# Aliases
|
|
||||||
alias ya='yarn'
|
|
||||||
alias yai='yarn init'
|
|
||||||
alias yaa='yarn add'
|
|
||||||
alias yaga='yarn global add'
|
|
||||||
alias yaad='yarn add --dev'
|
|
||||||
alias yau='yarn upgrade'
|
|
||||||
alias yarm='yarn remove'
|
|
||||||
alias yagrm='yarn global remove'
|
|
||||||
alias yaod='yarn outdated'
|
|
||||||
alias yapa='yarn pack'
|
|
||||||
alias yap='yarn publish'
|
|
||||||
alias yasu='yarn self-update'
|
|
||||||
alias yaru='yarn run'
|
|
||||||
alias yat='yarn test'
|
|
||||||
alias yas='yarn serve'
|
|
||||||
alias yacc='yarn cache clean'
|
|
||||||
alias yack='yarn check'
|
|
||||||
alias yals='yarn list'
|
|
||||||
alias yain='yarn info'
|
|
||||||
alias yali='yarn licenses ls'
|
|
||||||
alias yaloi='yarn login'
|
|
||||||
alias yaloo='yarn logout'
|
|
|
@ -1,159 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
# Initialize Bash It
|
|
||||||
BASH_IT_LOG_PREFIX="core: main: "
|
|
||||||
|
|
||||||
# Only set $BASH_IT if it's not already set
|
|
||||||
if [ -z "$BASH_IT" ]; then
|
|
||||||
# Setting $BASH to maintain backwards compatibility
|
|
||||||
export BASH_IT=$BASH
|
|
||||||
BASH="$(bash -c 'echo $BASH')"
|
|
||||||
export BASH
|
|
||||||
BASH_IT_OLD_BASH_SETUP=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Load composure first, so we support function metadata
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "${BASH_IT}"/vendor/github.com/erichs/composure/composure.sh
|
|
||||||
|
|
||||||
# We need to load logging module first as well in order to be able to log
|
|
||||||
# shellcheck source=./lib/log.bash
|
|
||||||
source "${BASH_IT}/lib/log.bash"
|
|
||||||
|
|
||||||
# We can only log it now
|
|
||||||
[ -z "$BASH_IT_OLD_BASH_SETUP" ] || _log_warning "BASH_IT variable not initialized, please upgrade your bash-it version and reinstall it!"
|
|
||||||
|
|
||||||
# For backwards compatibility, look in old BASH_THEME location
|
|
||||||
if [ -z "$BASH_IT_THEME" ]; then
|
|
||||||
_log_warning "BASH_IT_THEME variable not initialized, please upgrade your bash-it version and reinstall it!"
|
|
||||||
export BASH_IT_THEME="$BASH_THEME"
|
|
||||||
unset BASH_THEME
|
|
||||||
fi
|
|
||||||
|
|
||||||
# support 'plumbing' metadata
|
|
||||||
cite _about _param _example _group _author _version
|
|
||||||
cite about-alias about-plugin about-completion
|
|
||||||
|
|
||||||
# libraries, but skip appearance (themes) for now
|
|
||||||
_log_debug "Loading libraries(except appearance)..."
|
|
||||||
LIB="${BASH_IT}/lib/*.bash"
|
|
||||||
APPEARANCE_LIB="${BASH_IT}/lib/appearance.bash"
|
|
||||||
for _bash_it_config_file in $LIB; do
|
|
||||||
if [ "$_bash_it_config_file" != "$APPEARANCE_LIB" ]; then
|
|
||||||
filename=${_bash_it_config_file##*/}
|
|
||||||
filename=${filename%.bash}
|
|
||||||
BASH_IT_LOG_PREFIX="lib: ${filename}: "
|
|
||||||
_log_debug "Loading library file..."
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "$_bash_it_config_file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Load vendors
|
|
||||||
BASH_IT_LOG_PREFIX="vendor: "
|
|
||||||
for _bash_it_vendor_init in "${BASH_IT}"/vendor/init.d/*.bash; do
|
|
||||||
_log_debug "Loading \"$(basename "${_bash_it_vendor_init}" .bash)\"..."
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "${_bash_it_vendor_init}"
|
|
||||||
done
|
|
||||||
unset _bash_it_vendor_init
|
|
||||||
|
|
||||||
BASH_IT_LOG_PREFIX="core: main: "
|
|
||||||
# Load the global "enabled" directory
|
|
||||||
# "family" param is empty so that files get sources in glob order
|
|
||||||
# shellcheck source=./scripts/reloader.bash
|
|
||||||
source "${BASH_IT}/scripts/reloader.bash"
|
|
||||||
|
|
||||||
# Load enabled aliases, completion, plugins
|
|
||||||
for file_type in "aliases" "plugins" "completion"; do
|
|
||||||
# shellcheck source=./scripts/reloader.bash
|
|
||||||
source "${BASH_IT}/scripts/reloader.bash" "skip" "$file_type"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Load theme, if a theme was set
|
|
||||||
if [[ -n "${BASH_IT_THEME}" ]]; then
|
|
||||||
_log_debug "Loading \"${BASH_IT_THEME}\" theme..."
|
|
||||||
# Load colors and helpers first so they can be used in base theme
|
|
||||||
BASH_IT_LOG_PREFIX="themes: colors: "
|
|
||||||
# shellcheck source=./themes/colors.theme.bash
|
|
||||||
source "${BASH_IT}/themes/colors.theme.bash"
|
|
||||||
BASH_IT_LOG_PREFIX="themes: githelpers: "
|
|
||||||
# shellcheck source=./themes/githelpers.theme.bash
|
|
||||||
source "${BASH_IT}/themes/githelpers.theme.bash"
|
|
||||||
BASH_IT_LOG_PREFIX="themes: p4helpers: "
|
|
||||||
# shellcheck source=./themes/p4helpers.theme.bash
|
|
||||||
source "${BASH_IT}/themes/p4helpers.theme.bash"
|
|
||||||
BASH_IT_LOG_PREFIX="themes: command_duration: "
|
|
||||||
# shellcheck source=./themes/command_duration.theme.bash
|
|
||||||
source "${BASH_IT}/themes/command_duration.theme.bash"
|
|
||||||
BASH_IT_LOG_PREFIX="themes: base: "
|
|
||||||
# shellcheck source=./themes/base.theme.bash
|
|
||||||
source "${BASH_IT}/themes/base.theme.bash"
|
|
||||||
|
|
||||||
BASH_IT_LOG_PREFIX="lib: appearance: "
|
|
||||||
# appearance (themes) now, after all dependencies
|
|
||||||
# shellcheck source=./lib/appearance.bash
|
|
||||||
source "$APPEARANCE_LIB"
|
|
||||||
fi
|
|
||||||
|
|
||||||
BASH_IT_LOG_PREFIX="core: main: "
|
|
||||||
_log_debug "Loading custom aliases, completion, plugins..."
|
|
||||||
for file_type in "aliases" "completion" "plugins"; do
|
|
||||||
if [ -e "${BASH_IT}/${file_type}/custom.${file_type}.bash" ]; then
|
|
||||||
BASH_IT_LOG_PREFIX="${file_type}: custom: "
|
|
||||||
_log_debug "Loading component..."
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "${BASH_IT}/${file_type}/custom.${file_type}.bash"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Custom
|
|
||||||
BASH_IT_LOG_PREFIX="core: main: "
|
|
||||||
_log_debug "Loading general custom files..."
|
|
||||||
CUSTOM="${BASH_IT_CUSTOM:=${BASH_IT}/custom}/*.bash ${BASH_IT_CUSTOM:=${BASH_IT}/custom}/**/*.bash"
|
|
||||||
for _bash_it_config_file in $CUSTOM; do
|
|
||||||
if [ -e "${_bash_it_config_file}" ]; then
|
|
||||||
filename=$(basename "${_bash_it_config_file}")
|
|
||||||
filename=${filename%*.bash}
|
|
||||||
BASH_IT_LOG_PREFIX="custom: $filename: "
|
|
||||||
_log_debug "Loading custom file..."
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "$_bash_it_config_file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
unset _bash_it_config_file
|
|
||||||
if [[ $PROMPT ]]; then
|
|
||||||
export PS1="\[""$PROMPT""\]"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Adding Support for other OSes
|
|
||||||
PREVIEW="less"
|
|
||||||
|
|
||||||
if [ -s /usr/bin/gloobus-preview ]; then
|
|
||||||
PREVIEW="gloobus-preview"
|
|
||||||
elif [ -s /Applications/Preview.app ]; then
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
PREVIEW="/Applications/Preview.app"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Load all the Jekyll stuff
|
|
||||||
|
|
||||||
if [ -e "$HOME/.jekyllconfig" ]; then
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
. "$HOME/.jekyllconfig"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# BASH_IT_RELOAD_LEGACY is set.
|
|
||||||
if ! command -v reload &> /dev/null && [ -n "$BASH_IT_RELOAD_LEGACY" ]; then
|
|
||||||
case $OSTYPE in
|
|
||||||
darwin*)
|
|
||||||
alias reload='source ~/.bash_profile'
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
alias reload='source ~/.bashrc'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Disable trap DEBUG on subshells - https://github.com/Bash-it/bash-it/pull/1040
|
|
||||||
set +T
|
|
|
@ -1,121 +0,0 @@
|
||||||
#######################################################################
|
|
||||||
# Allow-list of files to be lint-checked by CI
|
|
||||||
#
|
|
||||||
# Directory Support
|
|
||||||
# Directory references are allowed within the file, ie:
|
|
||||||
#
|
|
||||||
# themes/powerline
|
|
||||||
#
|
|
||||||
# All files under the referenced directory will be checked
|
|
||||||
#
|
|
||||||
# Checking Files Locally
|
|
||||||
# You can manually invoke the check via:
|
|
||||||
#
|
|
||||||
# lint_clean_files.sh
|
|
||||||
#
|
|
||||||
|
|
||||||
# root directories
|
|
||||||
#
|
|
||||||
docs/
|
|
||||||
hooks/
|
|
||||||
|
|
||||||
# root files
|
|
||||||
#
|
|
||||||
.gitattributes
|
|
||||||
bash_it.sh
|
|
||||||
clean_files.txt
|
|
||||||
install.sh
|
|
||||||
lint_clean_files.sh
|
|
||||||
|
|
||||||
# aliases
|
|
||||||
#
|
|
||||||
aliases/available/dnf.aliases.bash
|
|
||||||
aliases/available/git.aliases.bash
|
|
||||||
aliases/available/vim.aliases.bash
|
|
||||||
|
|
||||||
# completions
|
|
||||||
#
|
|
||||||
completion/available/apm.completion.bash
|
|
||||||
completion/available/awless.completion.bash
|
|
||||||
completion/available/brew.completion.bash
|
|
||||||
completion/available/cargo.completion.bash
|
|
||||||
completion/available/composer.completion.bash
|
|
||||||
completion/available/conda.completion.bash
|
|
||||||
completion/available/consul.completion.bash
|
|
||||||
completion/available/django.completion.bash
|
|
||||||
completion/available/dmidecode.completion.bash
|
|
||||||
completion/available/docker-machine.completion.bash
|
|
||||||
completion/available/docker.completion.bash
|
|
||||||
completion/available/gcloud.completion.bash
|
|
||||||
completion/available/gem.completion.bash
|
|
||||||
completion/available/github-cli.completion.bash
|
|
||||||
completion/available/go.completion.bash
|
|
||||||
completion/available/helm.completion.bash
|
|
||||||
completion/available/jboss5.completion.bash
|
|
||||||
completion/available/jboss7.completion.bash
|
|
||||||
completion/available/jungle.completion.bash
|
|
||||||
completion/available/knife.completion.bash
|
|
||||||
completion/available/kontena.completion.bash
|
|
||||||
completion/available/kubectl.completion.bash
|
|
||||||
completion/available/lerna.completion.bash
|
|
||||||
completion/available/minikube.completion.bash
|
|
||||||
completion/available/ngrok.completion.bash
|
|
||||||
completion/available/notify-send.completion.bash
|
|
||||||
completion/available/npm.completion.bash
|
|
||||||
completion/available/packer.completion.bash
|
|
||||||
completion/available/pip.completion.bash
|
|
||||||
completion/available/pip3.completion.bash
|
|
||||||
completion/available/pipenv.completion.bash
|
|
||||||
completion/available/pipx.completion.bash
|
|
||||||
completion/available/rustup.completion.bash
|
|
||||||
completion/available/sdkman.completion.bash
|
|
||||||
completion/available/vault.completion.bash
|
|
||||||
completion/available/vuejs.completion.bash
|
|
||||||
completion/available/wpscan.completion.bash
|
|
||||||
|
|
||||||
# plugins
|
|
||||||
#
|
|
||||||
plugins/available/alias-completion.plugin.bash
|
|
||||||
plugins/available/basher.plugin.bash
|
|
||||||
plugins/available/cmd-returned-notify.plugin.bash
|
|
||||||
plugins/available/docker-machine.plugin.bash
|
|
||||||
plugins/available/git.plugin.bash
|
|
||||||
plugins/available/go.plugin.bash
|
|
||||||
plugins/available/goenv.plugin.bash
|
|
||||||
plugins/available/history-search.plugin.bash
|
|
||||||
plugins/available/history-substring-search.plugin.bash
|
|
||||||
plugins/available/history.plugin.bash
|
|
||||||
plugins/available/xterm.plugin.bash
|
|
||||||
|
|
||||||
# tests
|
|
||||||
#
|
|
||||||
test/plugins/alias-completion.plugin.bats
|
|
||||||
test/test_helper.bash
|
|
||||||
|
|
||||||
# themes
|
|
||||||
#
|
|
||||||
themes/90210
|
|
||||||
themes/agnoster
|
|
||||||
themes/atomic
|
|
||||||
themes/axin
|
|
||||||
themes/bakke
|
|
||||||
themes/barbuk
|
|
||||||
themes/base.theme.bash
|
|
||||||
themes/binaryanomaly
|
|
||||||
themes/bira
|
|
||||||
themes/bobby
|
|
||||||
themes/bobby-python
|
|
||||||
themes/brainy
|
|
||||||
themes/brunton
|
|
||||||
themes/candy
|
|
||||||
themes/command_duration.theme.bash
|
|
||||||
themes/easy
|
|
||||||
themes/modern
|
|
||||||
themes/powerline
|
|
||||||
themes/pure
|
|
||||||
themes/purity
|
|
||||||
|
|
||||||
# vendor init files
|
|
||||||
#
|
|
||||||
vendor/.gitattributes
|
|
||||||
vendor/init.d
|
|
|
@ -1,4 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
about-completion "apm completion"
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "${BASH_IT}"/vendor/github.com/vigo/apm-bash-completion/apm
|
|
|
@ -1,5 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
if _command_exists awless; then
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source <(awless completion bash)
|
|
||||||
fi
|
|
|
@ -1 +0,0 @@
|
||||||
[[ -x "$(which aws_completer)" ]] && complete -C "$(which aws_completer)" aws
|
|
|
@ -1,140 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
_bash-it-comp-enable-disable()
|
|
||||||
{
|
|
||||||
local enable_disable_args="alias completion plugin"
|
|
||||||
COMPREPLY=( $(compgen -W "${enable_disable_args}" -- ${cur}) )
|
|
||||||
}
|
|
||||||
|
|
||||||
_bash-it-comp-list-available-not-enabled()
|
|
||||||
{
|
|
||||||
subdirectory="$1"
|
|
||||||
|
|
||||||
local available_things
|
|
||||||
|
|
||||||
available_things=$(for f in `compgen -G "${BASH_IT}/$subdirectory/available/*.bash" | sort -d`;
|
|
||||||
do
|
|
||||||
file_entity=$(basename $f)
|
|
||||||
|
|
||||||
typeset enabled_component=$(command ls "${BASH_IT}/$subdirectory/enabled/"{[0-9]*$BASH_IT_LOAD_PRIORITY_SEPARATOR$file_entity,$file_entity} 2>/dev/null | head -1)
|
|
||||||
typeset enabled_component_global=$(command ls "${BASH_IT}/enabled/"[0-9]*$BASH_IT_LOAD_PRIORITY_SEPARATOR$file_entity 2>/dev/null | head -1)
|
|
||||||
|
|
||||||
if [ -z "$enabled_component" ] && [ -z "$enabled_component_global" ]
|
|
||||||
then
|
|
||||||
basename $f | sed -e 's/\(.*\)\..*\.bash/\1/g'
|
|
||||||
fi
|
|
||||||
done)
|
|
||||||
|
|
||||||
COMPREPLY=( $(compgen -W "all ${available_things}" -- ${cur}) )
|
|
||||||
}
|
|
||||||
|
|
||||||
_bash-it-comp-list-enabled()
|
|
||||||
{
|
|
||||||
local subdirectory="$1"
|
|
||||||
local suffix enabled_things
|
|
||||||
|
|
||||||
suffix=$(echo "$subdirectory" | sed -e 's/plugins/plugin/g')
|
|
||||||
|
|
||||||
enabled_things=$(for f in `sort -d <(compgen -G "${BASH_IT}/$subdirectory/enabled/*.${suffix}.bash") <(compgen -G "${BASH_IT}/enabled/*.${suffix}.bash")`;
|
|
||||||
do
|
|
||||||
basename $f | sed -e 's/\(.*\)\..*\.bash/\1/g' | sed -e "s/^[0-9]*---//g"
|
|
||||||
done)
|
|
||||||
|
|
||||||
COMPREPLY=( $(compgen -W "all ${enabled_things}" -- ${cur}) )
|
|
||||||
}
|
|
||||||
|
|
||||||
_bash-it-comp-list-available()
|
|
||||||
{
|
|
||||||
subdirectory="$1"
|
|
||||||
|
|
||||||
local enabled_things
|
|
||||||
|
|
||||||
enabled_things=$(for f in `compgen -G "${BASH_IT}/$subdirectory/available/*.bash" | sort -d`;
|
|
||||||
do
|
|
||||||
basename $f | sed -e 's/\(.*\)\..*\.bash/\1/g'
|
|
||||||
done)
|
|
||||||
|
|
||||||
COMPREPLY=( $(compgen -W "${enabled_things}" -- ${cur}) )
|
|
||||||
}
|
|
||||||
|
|
||||||
_bash-it-comp()
|
|
||||||
{
|
|
||||||
local cur prev opts
|
|
||||||
COMPREPLY=()
|
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
||||||
chose_opt="${COMP_WORDS[1]}"
|
|
||||||
file_type="${COMP_WORDS[2]}"
|
|
||||||
opts="disable enable help migrate reload restart doctor search show update version"
|
|
||||||
case "${chose_opt}" in
|
|
||||||
show)
|
|
||||||
local show_args="aliases completions plugins"
|
|
||||||
COMPREPLY=( $(compgen -W "${show_args}" -- ${cur}) )
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
help)
|
|
||||||
if [ x"${prev}" == x"aliases" ]; then
|
|
||||||
_bash-it-comp-list-available aliases
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
local help_args="aliases completions migrate plugins update"
|
|
||||||
COMPREPLY=( $(compgen -W "${help_args}" -- ${cur}) )
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
doctor)
|
|
||||||
local doctor_args="errors warnings all"
|
|
||||||
COMPREPLY=( $(compgen -W "${doctor_args}" -- ${cur}) )
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
update)
|
|
||||||
if [[ ${cur} == -* ]];then
|
|
||||||
local update_args="-s --silent"
|
|
||||||
else
|
|
||||||
local update_args="stable dev"
|
|
||||||
fi
|
|
||||||
COMPREPLY=( $(compgen -W "${update_args}" -- ${cur}) )
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
migrate | reload | search | version)
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
enable | disable)
|
|
||||||
if [ x"${chose_opt}" == x"enable" ];then
|
|
||||||
suffix="available-not-enabled"
|
|
||||||
else
|
|
||||||
suffix="enabled"
|
|
||||||
fi
|
|
||||||
case "${file_type}" in
|
|
||||||
alias)
|
|
||||||
_bash-it-comp-list-${suffix} aliases
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
plugin)
|
|
||||||
_bash-it-comp-list-${suffix} plugins
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
completion)
|
|
||||||
_bash-it-comp-list-${suffix} completion
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
_bash-it-comp-enable-disable
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# Activate completion for bash-it and its common misspellings
|
|
||||||
complete -F _bash-it-comp bash-it
|
|
||||||
complete -F _bash-it-comp bash-ti
|
|
||||||
complete -F _bash-it-comp shit
|
|
||||||
complete -F _bash-it-comp bashit
|
|
||||||
complete -F _bash-it-comp batshit
|
|
||||||
complete -F _bash-it-comp bash_it
|
|
|
@ -1,32 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
cite "about-completion"
|
|
||||||
about-completion "brew completion"
|
|
||||||
|
|
||||||
# Load late to make sure `system` completion loads first
|
|
||||||
# BASH_IT_LOAD_PRIORITY: 375
|
|
||||||
|
|
||||||
if [[ "$(uname -s)" != 'Darwin' ]]; then
|
|
||||||
_log_warning "unsupported operating system - only 'Darwin' is supported"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make sure brew is installed
|
|
||||||
_command_exists brew || return 0
|
|
||||||
|
|
||||||
BREW_PREFIX=${BREW_PREFIX:-$(brew --prefix)}
|
|
||||||
|
|
||||||
if [[ -r "$BREW_PREFIX"/etc/bash_completion.d/brew ]]; then
|
|
||||||
# shellcheck disable=1090
|
|
||||||
source "$BREW_PREFIX"/etc/bash_completion.d/brew
|
|
||||||
|
|
||||||
elif [[ -r "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh ]]; then
|
|
||||||
# shellcheck disable=1090
|
|
||||||
source "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh
|
|
||||||
|
|
||||||
elif [[ -f "$BREW_PREFIX"/completions/bash/brew ]]; then
|
|
||||||
# For the git-clone based installation, see here for more info:
|
|
||||||
# https://github.com/Bash-it/bash-it/issues/1458
|
|
||||||
# https://docs.brew.sh/Shell-Completion
|
|
||||||
# shellcheck disable=1090
|
|
||||||
source "$BREW_PREFIX"/completions/bash/brew
|
|
||||||
fi
|
|
|
@ -1,273 +0,0 @@
|
||||||
#! bash
|
|
||||||
# bash completion for the `bundle` command.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2008 Daniel Luz
|
|
||||||
|
|
||||||
# Permission is hereby granted, free of charge, to any person
|
|
||||||
# obtaining a copy of this software and associated documentation
|
|
||||||
# files (the "Software"), to deal in the Software without
|
|
||||||
# restriction, including without limitation the rights to use,
|
|
||||||
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the
|
|
||||||
# Software is furnished to do so, subject to the following
|
|
||||||
# conditions:
|
|
||||||
|
|
||||||
# The above copyright notice and this permission notice shall be
|
|
||||||
# included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
||||||
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
# OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
#
|
|
||||||
# To use, source this file on bash:
|
|
||||||
# . completion-bundle
|
|
||||||
|
|
||||||
__bundle() {
|
|
||||||
local bundle_bin=("${_RUBY_COMMAND_PREFIX[@]}" "$1")
|
|
||||||
local cur prev
|
|
||||||
_get_comp_words_by_ref -n : cur prev
|
|
||||||
local bundle_command
|
|
||||||
local bundle_command_index
|
|
||||||
__bundle_get_command
|
|
||||||
COMPREPLY=()
|
|
||||||
|
|
||||||
local options
|
|
||||||
if [[ $cur = -* && $bundle_command != exec ]]; then
|
|
||||||
options="-V --help --no-color --no-no-color --verbose --no-verbose"
|
|
||||||
case $bundle_command in
|
|
||||||
"")
|
|
||||||
options="$options --version";;
|
|
||||||
check)
|
|
||||||
options="$options --dry-run --gemfile --path -r --retry";;
|
|
||||||
clean)
|
|
||||||
options="$options --dry-run --force";;
|
|
||||||
config)
|
|
||||||
options="$options --local --global --delete";;
|
|
||||||
doctor)
|
|
||||||
options="$options --gemfile --quiet --no-quiet";;
|
|
||||||
gem)
|
|
||||||
options="$options -b -e -t --bin --coc --no-coc --edit --exe
|
|
||||||
--no-exe --ext --no-ext --mit --no-mit --test";;
|
|
||||||
init)
|
|
||||||
options="$options --gemspec";;
|
|
||||||
install)
|
|
||||||
options="$options --binstubs --clean --deployment --force --frozen
|
|
||||||
--full-index --gemfile --jobs --local --no-cache
|
|
||||||
--no-prune --path --quiet --retry --shebang --standalone
|
|
||||||
--system --trust-policy --with --without";;
|
|
||||||
lock)
|
|
||||||
options="$options --add-platform --conservative --full-index
|
|
||||||
--local --lockfile --major --minor --patch --print
|
|
||||||
--remove-platform --strict --update";;
|
|
||||||
package)
|
|
||||||
options="$options --all --all-platforms";;
|
|
||||||
platform)
|
|
||||||
options="$options --ruby";;
|
|
||||||
show)
|
|
||||||
options="$options --outdated --paths --no-paths";;
|
|
||||||
update)
|
|
||||||
options="$options --bundler --conservative --force --full-index
|
|
||||||
--group --jobs --local --major --minor --patch --quiet
|
|
||||||
--ruby --source --strict";;
|
|
||||||
viz)
|
|
||||||
options="$options -f -F -R -v -W --file --format --requirements
|
|
||||||
--no-requirements --version --no-version --without";;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
case $bundle_command in
|
|
||||||
"" | help)
|
|
||||||
options="help install update package exec config
|
|
||||||
check show outdated console open lock viz init gem
|
|
||||||
platform clean doctor"
|
|
||||||
;;
|
|
||||||
check | install)
|
|
||||||
case $prev in
|
|
||||||
--binstubs | --path)
|
|
||||||
_filedir -d
|
|
||||||
return;;
|
|
||||||
--standalone | --with | --without)
|
|
||||||
__bundle_complete_groups
|
|
||||||
return;;
|
|
||||||
--trust-policy)
|
|
||||||
options="HighSecurity MediumSecurity LowSecurity
|
|
||||||
AlmostNoSecurity NoSecurity";;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
config)
|
|
||||||
case $prev in
|
|
||||||
config | --*)
|
|
||||||
case $cur in
|
|
||||||
local.*)
|
|
||||||
options=($(__bundle_exec_ruby 'puts Bundler.definition.specs.to_hash.keys'))
|
|
||||||
options=("${options[*]/#/local.}")
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
options=(path frozen without bin gemfile ssl_ca_cert
|
|
||||||
ssl_client_cert cache_path disable_multisource
|
|
||||||
ignore_messages retry redirect timeout
|
|
||||||
force_ruby_platform specific_platform
|
|
||||||
disable_checksum_validation disable_version_check
|
|
||||||
allow_offline_install auto_install
|
|
||||||
cache_all_platforms cache_all clean console
|
|
||||||
disable_exec_load disable_local_branch_check
|
|
||||||
disable_shared_gems jobs major_deprecations
|
|
||||||
no_install no_prune only_update_to_newer_versions
|
|
||||||
plugins shebang silence_root_warning
|
|
||||||
ssl_verify_mode system_bindir user_agent)
|
|
||||||
# We want to suggest the options above as complete words,
|
|
||||||
# and also "local." and "mirror." as prefixes
|
|
||||||
# To achieve that, disable automatic space insertion,
|
|
||||||
# insert it manually, then add the non-spaced prefixes
|
|
||||||
compopt -o nospace
|
|
||||||
options=("${options[@]/%/ }")
|
|
||||||
# And add prefix suggestions
|
|
||||||
options+=(local. mirror.)
|
|
||||||
# Override $IFS for completion to work
|
|
||||||
local IFS=$'\n'
|
|
||||||
COMPREPLY=($(compgen -W '${options[@]}' -- "$cur"))
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
path | local.*)
|
|
||||||
_filedir -d
|
|
||||||
return;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
exec)
|
|
||||||
if [[ $COMP_CWORD -eq $bundle_command_index ]]; then
|
|
||||||
# Figure out Bundler's binaries dir
|
|
||||||
local bundler_bin=$(__bundle_exec_ruby 'puts Bundler.bundle_path + "bin"')
|
|
||||||
if [[ -d $bundler_bin ]]; then
|
|
||||||
local binaries=("$bundler_bin"/*)
|
|
||||||
# If there are binaries, strip directory name and use them
|
|
||||||
[[ -f "$binaries" ]] && options="${binaries[@]##*/}"
|
|
||||||
else
|
|
||||||
# No binaries found; use full command completion
|
|
||||||
COMPREPLY=($(compgen -c -- "$cur"))
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
local _RUBY_COMMAND_PREFIX=("${bundle_bin[@]}" exec)
|
|
||||||
_command_offset $bundle_command_index
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
gem)
|
|
||||||
case $prev in
|
|
||||||
-e | --edit)
|
|
||||||
COMPREPLY=($(compgen -c -- "$cur"))
|
|
||||||
return;;
|
|
||||||
-t | --test)
|
|
||||||
options="minitest rspec";;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
update)
|
|
||||||
case $prev in
|
|
||||||
--group)
|
|
||||||
__bundle_complete_groups
|
|
||||||
return;;
|
|
||||||
*)
|
|
||||||
options=($(__bundle_exec_ruby 'puts Bundler.definition.specs.to_hash.keys'))
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
viz)
|
|
||||||
case $prev in
|
|
||||||
-F | --format)
|
|
||||||
options="dot jpg png svg";;
|
|
||||||
-W | --without)
|
|
||||||
__bundle_complete_groups
|
|
||||||
return;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
COMPREPLY=($(compgen -W "${options[*]}" -- "$cur"))
|
|
||||||
}
|
|
||||||
|
|
||||||
__bundle_get_command() {
|
|
||||||
local i
|
|
||||||
for ((i=1; i < $COMP_CWORD; ++i)); do
|
|
||||||
local arg=${COMP_WORDS[$i]}
|
|
||||||
|
|
||||||
case $arg in
|
|
||||||
[^-]*)
|
|
||||||
bundle_command=$arg
|
|
||||||
bundle_command_index=$((i + 1))
|
|
||||||
return;;
|
|
||||||
--version)
|
|
||||||
# Command-killer
|
|
||||||
bundle_command=-
|
|
||||||
return;;
|
|
||||||
--help)
|
|
||||||
bundle_command=help
|
|
||||||
bundle_command_index=$((i + 1))
|
|
||||||
return;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Provides completion for Bundler group names.
|
|
||||||
#
|
|
||||||
# Multiple groups can be entered, separated either by spaces or by colons.
|
|
||||||
# Input is read from $cur, and the result is directly written to $COMPREPLY.
|
|
||||||
__bundle_complete_groups() {
|
|
||||||
# Group being currently written
|
|
||||||
local cur_group=${cur##*[ :]}
|
|
||||||
# All groups written before
|
|
||||||
local prefix=${cur%"$cur_group"}
|
|
||||||
local groups=$(__bundle_exec_ruby 'puts Bundler.definition.dependencies.map(&:groups).reduce(:|).map(&:to_s)')
|
|
||||||
if [[ ! $groups ]]; then
|
|
||||||
COMPREPLY=()
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
# Duplicate "default" and anything already in $prefix, so that `uniq`
|
|
||||||
# strips it; groups may be separated by ':', ' ', or '\ '
|
|
||||||
local excluded=$'\ndefault\n'${prefix//[: \'\"\\]/$'\n'}
|
|
||||||
# Include them twice to ensure they are duplicates
|
|
||||||
groups=$groups$excluded$excluded
|
|
||||||
COMPREPLY=($(compgen -W "$(sort <<<"$groups" | uniq -u)" -- "$cur_group"))
|
|
||||||
# Prepend prefix to all entries
|
|
||||||
COMPREPLY=("${COMPREPLY[@]/#/$prefix}")
|
|
||||||
__ltrim_colon_completions "$cur"
|
|
||||||
}
|
|
||||||
|
|
||||||
# __bundle_exec_ruby <script> [args...]
|
|
||||||
#
|
|
||||||
# Runs a Ruby script with Bundler loaded.
|
|
||||||
# Results may be cached.
|
|
||||||
__bundle_exec_ruby() {
|
|
||||||
local bundle_bin=(${bundle_bin[@]:-bundle})
|
|
||||||
# Lockfile is inferred here, and might not be correct (for example, when
|
|
||||||
# running on a subdirectory). However, a wrong file path won't be a
|
|
||||||
# cadastrophic mistake; it just means the cache won't be invalidated when
|
|
||||||
# the local gem list changes (but will still invalidate if the command is
|
|
||||||
# run on another directory)
|
|
||||||
local lockfile=$PWD/Gemfile.lock
|
|
||||||
local cachedir=${XDG_CACHE_HOME:-~/.cache}/completion-ruby
|
|
||||||
local cachefile=$cachedir/bundle--exec-ruby
|
|
||||||
# A representation of all arguments with newlines replaced by spaces,
|
|
||||||
# to fit in a single line as a cache identifier
|
|
||||||
local cache_id_line="${bundle_bin[*]} @ $lockfile: ${*//$'\n'/ }"
|
|
||||||
|
|
||||||
if [[ (! -f $lockfile || $cachefile -nt $lockfile) &&
|
|
||||||
$(head -n 1 -- "$cachefile" 2>/dev/null) = "$cache_id_line" ]]; then
|
|
||||||
tail -n +2 -- "$cachefile"
|
|
||||||
else
|
|
||||||
local output=$("${bundle_bin[@]}" exec ruby -e "$@" 2>/dev/null)
|
|
||||||
if [[ $? -eq 0 ]]; then
|
|
||||||
(mkdir -p -- "$cachedir" &&
|
|
||||||
echo "$cache_id_line"$'\n'"$output" >$cachefile) 2>/dev/null
|
|
||||||
echo "$output"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
complete -F __bundle -o bashdefault -o default bundle
|
|
||||||
# vim: ai ft=sh sw=4 sts=4 et
|
|
|
@ -1,24 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
# Bash completion support for Capistrano.
|
|
||||||
|
|
||||||
export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}
|
|
||||||
|
|
||||||
_capcomplete() {
|
|
||||||
if [ -f Capfile ]; then
|
|
||||||
recent=`ls -t .cap_tasks~ Capfile **/*.cap 2> /dev/null | head -n 1`
|
|
||||||
if [[ $recent != '.cap_tasks~' ]]; then
|
|
||||||
cap --version | grep 'Capistrano v2.' > /dev/null
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
# Capistrano 2.x
|
|
||||||
cap --tool --verbose --tasks | cut -d " " -f 2 > .cap_tasks~
|
|
||||||
else
|
|
||||||
# Capistrano 3.x
|
|
||||||
cap --all --tasks | cut -d " " -f 2 > .cap_tasks~
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
COMPREPLY=($(compgen -W "`cat .cap_tasks~`" -- ${COMP_WORDS[COMP_CWORD]}))
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
complete -o default -o nospace -F _capcomplete cap
|
|
|
@ -1,6 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
# cargo (Rust package manager) completion
|
|
||||||
|
|
||||||
if _binary_exists rustup && _binary_exists cargo; then
|
|
||||||
eval "$(rustup completions bash cargo)"
|
|
||||||
fi
|
|
|
@ -1,129 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
cite "about-completion"
|
|
||||||
about-completion "composer completion"
|
|
||||||
|
|
||||||
function __composer_completion() {
|
|
||||||
local cur coms opts com
|
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref -n : cur words
|
|
||||||
|
|
||||||
# lookup for command
|
|
||||||
for word in "${words[@]:1}"; do
|
|
||||||
if [[ $word != -* ]]; then
|
|
||||||
com=$word
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# completing for an option
|
|
||||||
if [[ ${cur} == --* ]]; then
|
|
||||||
opts="--help --quiet --verbose --version --ansi --no-ansi --no-interaction --profile --no-plugins --working-dir"
|
|
||||||
|
|
||||||
case "$com" in
|
|
||||||
about)
|
|
||||||
opts="${opts} "
|
|
||||||
;;
|
|
||||||
archive)
|
|
||||||
opts="${opts} --format --dir --file"
|
|
||||||
;;
|
|
||||||
browse)
|
|
||||||
opts="${opts} --homepage --show"
|
|
||||||
;;
|
|
||||||
clear-cache)
|
|
||||||
opts="${opts} "
|
|
||||||
;;
|
|
||||||
config)
|
|
||||||
opts="${opts} --global --editor --auth --unset --list --file --absolute"
|
|
||||||
;;
|
|
||||||
create-project)
|
|
||||||
opts="${opts} --stability --prefer-source --prefer-dist --repository --repository-url --dev --no-dev --no-custom-installers --no-scripts --no-progress --no-secure-http --keep-vcs --no-install --ignore-platform-reqs"
|
|
||||||
;;
|
|
||||||
depends)
|
|
||||||
opts="${opts} --recursive --tree"
|
|
||||||
;;
|
|
||||||
diagnose)
|
|
||||||
opts="${opts} "
|
|
||||||
;;
|
|
||||||
dump-autoload)
|
|
||||||
opts="${opts} --no-scripts --optimize --classmap-authoritative --apcu --no-dev"
|
|
||||||
;;
|
|
||||||
exec)
|
|
||||||
opts="${opts} --list"
|
|
||||||
;;
|
|
||||||
global)
|
|
||||||
opts="${opts} "
|
|
||||||
;;
|
|
||||||
help)
|
|
||||||
opts="${opts} --xml --format --raw"
|
|
||||||
;;
|
|
||||||
init)
|
|
||||||
opts="${opts} --name --description --author --type --homepage --require --require-dev --stability --license --repository"
|
|
||||||
;;
|
|
||||||
install)
|
|
||||||
opts="${opts} --prefer-source --prefer-dist --dry-run --dev --no-dev --no-custom-installers --no-autoloader --no-scripts --no-progress --no-suggest --optimize-autoloader --classmap-authoritative --apcu-autoloader --ignore-platform-reqs"
|
|
||||||
;;
|
|
||||||
licenses)
|
|
||||||
opts="${opts} --format --no-dev"
|
|
||||||
;;
|
|
||||||
list)
|
|
||||||
opts="${opts} --xml --raw --format"
|
|
||||||
;;
|
|
||||||
outdated)
|
|
||||||
opts="${opts} --outdated --all --direct --strict"
|
|
||||||
;;
|
|
||||||
prohibits)
|
|
||||||
opts="${opts} --recursive --tree"
|
|
||||||
;;
|
|
||||||
remove)
|
|
||||||
opts="${opts} --dev --no-progress --no-update --no-scripts --update-no-dev --update-with-dependencies --no-update-with-dependencies --ignore-platform-reqs --optimize-autoloader --classmap-authoritative --apcu-autoloader"
|
|
||||||
;;
|
|
||||||
require)
|
|
||||||
opts="${opts} --dev --prefer-source --prefer-dist --no-progress --no-suggest --no-update --no-scripts --update-no-dev --update-with-dependencies --ignore-platform-reqs --prefer-stable --prefer-lowest --sort-packages --optimize-autoloader --classmap-authoritative --apcu-autoloader"
|
|
||||||
;;
|
|
||||||
run-script)
|
|
||||||
opts="${opts} --timeout --dev --no-dev --list"
|
|
||||||
;;
|
|
||||||
search)
|
|
||||||
opts="${opts} --only-name --type"
|
|
||||||
;;
|
|
||||||
self-update)
|
|
||||||
opts="${opts} --rollback --clean-backups --no-progress --update-keys --stable --preview --snapshot"
|
|
||||||
;;
|
|
||||||
show)
|
|
||||||
opts="${opts} --all --installed --platform --available --self --name-only --path --tree --latest --outdated --minor-only --direct --strict"
|
|
||||||
;;
|
|
||||||
status)
|
|
||||||
opts="${opts} "
|
|
||||||
;;
|
|
||||||
suggests)
|
|
||||||
opts="${opts} --by-package --by-suggestion --no-dev"
|
|
||||||
;;
|
|
||||||
update)
|
|
||||||
opts="${opts} --prefer-source --prefer-dist --dry-run --dev --no-dev --lock --no-custom-installers --no-autoloader --no-scripts --no-progress --no-suggest --with-dependencies --optimize-autoloader --classmap-authoritative --apcu-autoloader --ignore-platform-reqs --prefer-stable --prefer-lowest --interactive --root-reqs"
|
|
||||||
;;
|
|
||||||
validate)
|
|
||||||
opts="${opts} --no-check-all --no-check-lock --no-check-publish --with-dependencies --strict"
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
|
||||||
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
|
|
||||||
__ltrim_colon_completions "$cur"
|
|
||||||
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# completing for a command
|
|
||||||
if [[ "$cur" == "$com" ]]; then
|
|
||||||
coms="about archive browse clear-cache config create-project depends diagnose dump-autoload exec global help init install licenses list outdated prohibits remove require run-script search self-update show status suggests update validate"
|
|
||||||
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
COMPREPLY=($(compgen -W "${coms}" -- "${cur}"))
|
|
||||||
__ltrim_colon_completions "$cur"
|
|
||||||
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
complete -o default -F __composer_completion composer
|
|
|
@ -1,11 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
cite "about-completion"
|
|
||||||
about-completion "conda completion"
|
|
||||||
|
|
||||||
if _command_exists conda; then
|
|
||||||
if _command_exists register-python-argcomplete; then
|
|
||||||
eval "$(register-python-argcomplete conda)"
|
|
||||||
else
|
|
||||||
_log_warning "Argcomplete not found. Please run 'conda install argcomplete'"
|
|
||||||
fi
|
|
||||||
fi
|
|
|
@ -1,7 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
cite "about-completion"
|
|
||||||
about-completion "Hashicorp consul completion"
|
|
||||||
|
|
||||||
if _command_exists consul; then
|
|
||||||
complete -C "$(which consul)" consul
|
|
||||||
fi
|
|
|
@ -1 +0,0 @@
|
||||||
_log_warning 'Bash completion for "crystal" is now covered by "system". This completion can be disabled.'
|
|
|
@ -1,175 +0,0 @@
|
||||||
# defaults
|
|
||||||
# Bash command line completion for defaults
|
|
||||||
#
|
|
||||||
# Created by Jonathon Mah on 2006-11-08.
|
|
||||||
# Copyright 2006 Playhaus. All rights reserved.
|
|
||||||
#
|
|
||||||
# Version 1.0 (2006-11-08)
|
|
||||||
|
|
||||||
|
|
||||||
_defaults_domains()
|
|
||||||
{
|
|
||||||
local cur
|
|
||||||
COMPREPLY=()
|
|
||||||
cur=${COMP_WORDS[COMP_CWORD]}
|
|
||||||
|
|
||||||
local domains=$( defaults domains | sed -e 's/, /:/g' | tr : '\n' | sed -e 's/ /\\ /g' | grep -i "^$cur" )
|
|
||||||
local IFS=$'\n'
|
|
||||||
COMPREPLY=( $domains )
|
|
||||||
if [[ $( echo '-app' | grep "^$cur" ) ]]; then
|
|
||||||
COMPREPLY[${#COMPREPLY[@]}]="-app"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_defaults()
|
|
||||||
{
|
|
||||||
local cur prev host_opts cmds cmd domain keys key_index
|
|
||||||
cur=${COMP_WORDS[COMP_CWORD]}
|
|
||||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
||||||
|
|
||||||
host_opts='-currentHost -host'
|
|
||||||
cmds='read read-type write rename delete domains find help'
|
|
||||||
|
|
||||||
if [[ $COMP_CWORD -eq 1 ]]; then
|
|
||||||
COMPREPLY=( $( compgen -W "$host_opts $cmds" -- $cur ) )
|
|
||||||
return 0
|
|
||||||
elif [[ $COMP_CWORD -eq 2 ]]; then
|
|
||||||
if [[ "$prev" == "-currentHost" ]]; then
|
|
||||||
COMPREPLY=( $( compgen -W "$cmds" -- $cur ) )
|
|
||||||
return 0
|
|
||||||
elif [[ "$prev" == "-host" ]]; then
|
|
||||||
return 0
|
|
||||||
_known_hosts -a
|
|
||||||
else
|
|
||||||
_defaults_domains
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
elif [[ $COMP_CWORD -eq 3 ]]; then
|
|
||||||
if [[ ${COMP_WORDS[1]} == "-host" ]]; then
|
|
||||||
_defaults_domains
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Both a domain and command have been specified
|
|
||||||
|
|
||||||
if [[ ${COMP_WORDS[1]} == [${cmds// /|}] ]]; then
|
|
||||||
cmd=${COMP_WORDS[1]}
|
|
||||||
domain=${COMP_WORDS[2]}
|
|
||||||
key_index=3
|
|
||||||
if [[ "$domain" == "-app" ]]; then
|
|
||||||
if [[ $COMP_CWORD -eq 3 ]]; then
|
|
||||||
# Completing application name. Can't help here, sorry
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
domain="-app ${COMP_WORDS[3]}"
|
|
||||||
key_index=4
|
|
||||||
fi
|
|
||||||
elif [[ ${COMP_WORDS[2]} == "-currentHost" ]] && [[ ${COMP_WORDS[2]} == [${cmds// /|}] ]]; then
|
|
||||||
cmd=${COMP_WORDS[2]}
|
|
||||||
domain=${COMP_WORDS[3]}
|
|
||||||
key_index=4
|
|
||||||
if [[ "$domain" == "-app" ]]; then
|
|
||||||
if [[ $COMP_CWORD -eq 4 ]]; then
|
|
||||||
# Completing application name. Can't help here, sorry
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
domain="-app ${COMP_WORDS[4]}"
|
|
||||||
key_index=5
|
|
||||||
fi
|
|
||||||
elif [[ ${COMP_WORDS[3]} == "-host" ]] && [[ ${COMP_WORDS[3]} == [${cmds// /|}] ]]; then
|
|
||||||
cmd=${COMP_WORDS[3]}
|
|
||||||
domain=${COMP_WORDS[4]}
|
|
||||||
key_index=5
|
|
||||||
if [[ "$domain" == "-app" ]]; then
|
|
||||||
if [[ $COMP_CWORD -eq 5 ]]; then
|
|
||||||
# Completing application name. Can't help here, sorry
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
domain="-app ${COMP_WORDS[5]}"
|
|
||||||
key_index=6
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
keys=$( defaults read $domain 2>/dev/null | sed -n -e '/^ [^}) ]/p' | sed -e 's/^ \([^" ]\{1,\}\) = .*$/\1/g' -e 's/^ "\([^"]\{1,\}\)" = .*$/\1/g' | sed -e 's/ /\\ /g' )
|
|
||||||
|
|
||||||
case $cmd in
|
|
||||||
read|read-type)
|
|
||||||
# Complete key
|
|
||||||
local IFS=$'\n'
|
|
||||||
COMPREPLY=( $( echo "$keys" | grep -i "^${cur//\\/\\\\}" ) )
|
|
||||||
;;
|
|
||||||
write)
|
|
||||||
if [[ $key_index -eq $COMP_CWORD ]]; then
|
|
||||||
# Complete key
|
|
||||||
local IFS=$'\n'
|
|
||||||
COMPREPLY=( $( echo "$keys" | grep -i "^${cur//\\/\\\\}" ) )
|
|
||||||
elif [[ $((key_index+1)) -eq $COMP_CWORD ]]; then
|
|
||||||
# Complete value type
|
|
||||||
# Unfortunately ${COMP_WORDS[key_index]} fails on keys with spaces
|
|
||||||
local value_types='-string -data -integer -float -boolean -date -array -array-add -dict -dict-add'
|
|
||||||
local cur_type=$( defaults read-type $domain ${COMP_WORDS[key_index]} 2>/dev/null | sed -e 's/^Type is \(.*\)/-\1/' -e's/dictionary/dict/' | grep "^$cur" )
|
|
||||||
if [[ $cur_type ]]; then
|
|
||||||
COMPREPLY=( $cur_type )
|
|
||||||
else
|
|
||||||
COMPREPLY=( $( compgen -W "$value_types" -- $cur ) )
|
|
||||||
fi
|
|
||||||
elif [[ $((key_index+2)) -eq $COMP_CWORD ]]; then
|
|
||||||
# Complete value
|
|
||||||
# Unfortunately ${COMP_WORDS[key_index]} fails on keys with spaces
|
|
||||||
COMPREPLY=( $( defaults read $domain ${COMP_WORDS[key_index]} 2>/dev/null | grep -i "^${cur//\\/\\\\}" ) )
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
rename)
|
|
||||||
if [[ $key_index -eq $COMP_CWORD ]] ||
|
|
||||||
[[ $((key_index+1)) -eq $COMP_CWORD ]]; then
|
|
||||||
# Complete source and destination keys
|
|
||||||
local IFS=$'\n'
|
|
||||||
COMPREPLY=( $( echo "$keys" | grep -i "^${cur//\\/\\\\}" ) )
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
delete)
|
|
||||||
if [[ $key_index -eq $COMP_CWORD ]]; then
|
|
||||||
# Complete key
|
|
||||||
local IFS=$'\n'
|
|
||||||
COMPREPLY=( $( echo "$keys" | grep -i "^${cur//\\/\\\\}" ) )
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
complete -F _defaults -o default defaults
|
|
||||||
|
|
||||||
|
|
||||||
# This file is licensed under the BSD license, as follows:
|
|
||||||
#
|
|
||||||
# Copyright (c) 2006, Playhaus
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions are met:
|
|
||||||
#
|
|
||||||
# * Redistributions of source code must retain the above copyright notice, this
|
|
||||||
# list of conditions and the following disclaimer.
|
|
||||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
# this list of conditions and the following disclaimer in the documentation
|
|
||||||
# and/or other materials provided with the distribution.
|
|
||||||
# * Neither the name of the Playhaus nor the names of its contributors may be
|
|
||||||
# used to endorse or promote products derived from this software without
|
|
||||||
# specific prior written permission.
|
|
||||||
#
|
|
||||||
# This software is provided by the copyright holders and contributors "as is"
|
|
||||||
# and any express or implied warranties, including, but not limited to, the
|
|
||||||
# implied warranties of merchantability and fitness for a particular purpose are
|
|
||||||
# disclaimed. In no event shall the copyright owner or contributors be liable
|
|
||||||
# for any direct, indirect, incidental, special, exemplary, or consequential
|
|
||||||
# damages (including, but not limited to, procurement of substitute goods or
|
|
||||||
# services; loss of use, data, or profits; or business interruption) however
|
|
||||||
# caused and on any theory of liability, whether in contract, strict liability,
|
|
||||||
# or tort (including negligence or otherwise) arising in any way out of the use
|
|
||||||
# of this software, even if advised of the possibility of such damage.
|
|
|
@ -1,15 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
# Bash completion support for the 'dirs' plugin (commands G, R).
|
|
||||||
|
|
||||||
_dirs-complete() {
|
|
||||||
local CURRENT_PROMPT="${COMP_WORDS[COMP_CWORD]}"
|
|
||||||
|
|
||||||
# parse all defined shortcuts from ~/.dirs
|
|
||||||
if [ -r "$HOME/.dirs" ]; then
|
|
||||||
COMPREPLY=($(compgen -W "$(grep -v '^#' ~/.dirs | sed -e 's/\(.*\)=.*/\1/')" -- ${CURRENT_PROMPT}) )
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
complete -o default -o nospace -F _dirs-complete G R
|
|
|
@ -1,4 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
about-completion "django completion"
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "${BASH_IT}"/vendor/github.com/django/django/extras/django_bash_completion
|
|
|
@ -1,20 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
|
|
||||||
function __dmidecode_completion() {
|
|
||||||
local prev=$(_get_pword)
|
|
||||||
local curr=$(_get_cword)
|
|
||||||
|
|
||||||
case $prev in
|
|
||||||
-s | --string | -t | --type)
|
|
||||||
OPTS=$(dmidecode "$prev" 2>&1 | grep -E '^ ' | sed 's/ *//g')
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
COMPREPLY=($(compgen -W "$OPTS" -- "$curr"))
|
|
||||||
;;
|
|
||||||
dmidecode)
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
COMPREPLY=($(compgen -W "-d --dev-mem -h --help -q --quiet -s --string -t --type -H --handle -u --dump{,-bin} --from-dump --no-sysfs --oem-string -V --version" -- "$curr"))
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
complete -F __dmidecode_completion dmidecode
|
|
|
@ -1,688 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
# Copyright (c) 2014 Docker, Inc
|
|
||||||
|
|
||||||
# bash completion for docker-compose
|
|
||||||
#
|
|
||||||
# This work is based on the completion for the docker command.
|
|
||||||
#
|
|
||||||
# This script provides completion of:
|
|
||||||
# - commands and their options
|
|
||||||
# - service names
|
|
||||||
# - filepaths
|
|
||||||
#
|
|
||||||
# To enable the completions either:
|
|
||||||
# - place this file in /etc/bash_completion.d
|
|
||||||
# or
|
|
||||||
# - copy this file to e.g. ~/.docker-compose-completion.sh and add the line
|
|
||||||
# below to your .bashrc after bash completion features are loaded
|
|
||||||
# . ~/.docker-compose-completion.sh
|
|
||||||
|
|
||||||
__docker_compose_previous_extglob_setting=$(shopt -p extglob)
|
|
||||||
shopt -s extglob
|
|
||||||
|
|
||||||
__docker_compose_q() {
|
|
||||||
docker-compose 2>/dev/null "${top_level_options[@]}" "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Transforms a multiline list of strings into a single line string
|
|
||||||
# with the words separated by "|".
|
|
||||||
__docker_compose_to_alternatives() {
|
|
||||||
local parts=( $1 )
|
|
||||||
local IFS='|'
|
|
||||||
echo "${parts[*]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Transforms a multiline list of options into an extglob pattern
|
|
||||||
# suitable for use in case statements.
|
|
||||||
__docker_compose_to_extglob() {
|
|
||||||
local extglob=$( __docker_compose_to_alternatives "$1" )
|
|
||||||
echo "@($extglob)"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Determines whether the option passed as the first argument exist on
|
|
||||||
# the commandline. The option may be a pattern, e.g. `--force|-f`.
|
|
||||||
__docker_compose_has_option() {
|
|
||||||
local pattern="$1"
|
|
||||||
for (( i=2; i < $cword; ++i)); do
|
|
||||||
if [[ ${words[$i]} =~ ^($pattern)$ ]] ; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Returns `key` if we are currently completing the value of a map option (`key=value`)
|
|
||||||
# which matches the extglob passed in as an argument.
|
|
||||||
# This function is needed for key-specific completions.
|
|
||||||
__docker_compose_map_key_of_current_option() {
|
|
||||||
local glob="$1"
|
|
||||||
|
|
||||||
local key glob_pos
|
|
||||||
if [ "$cur" = "=" ] ; then # key= case
|
|
||||||
key="$prev"
|
|
||||||
glob_pos=$((cword - 2))
|
|
||||||
elif [[ $cur == *=* ]] ; then # key=value case (OSX)
|
|
||||||
key=${cur%=*}
|
|
||||||
glob_pos=$((cword - 1))
|
|
||||||
elif [ "$prev" = "=" ] ; then
|
|
||||||
key=${words[$cword - 2]} # key=value case
|
|
||||||
glob_pos=$((cword - 3))
|
|
||||||
else
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ "${words[$glob_pos]}" = "=" ] && ((glob_pos--)) # --option=key=value syntax
|
|
||||||
|
|
||||||
[[ ${words[$glob_pos]} == @($glob) ]] && echo "$key"
|
|
||||||
}
|
|
||||||
|
|
||||||
# suppress trailing whitespace
|
|
||||||
__docker_compose_nospace() {
|
|
||||||
# compopt is not available in ancient bash versions
|
|
||||||
type compopt &>/dev/null && compopt -o nospace
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Outputs a list of all defined services, regardless of their running state.
|
|
||||||
# Arguments for `docker-compose ps` may be passed in order to filter the service list,
|
|
||||||
# e.g. `status=running`.
|
|
||||||
__docker_compose_services() {
|
|
||||||
__docker_compose_q ps --services "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Applies completion of services based on the current value of `$cur`.
|
|
||||||
# Arguments for `docker-compose ps` may be passed in order to filter the service list,
|
|
||||||
# see `__docker_compose_services`.
|
|
||||||
__docker_compose_complete_services() {
|
|
||||||
COMPREPLY=( $(compgen -W "$(__docker_compose_services "$@")" -- "$cur") )
|
|
||||||
}
|
|
||||||
|
|
||||||
# The services for which at least one running container exists
|
|
||||||
__docker_compose_complete_running_services() {
|
|
||||||
local names=$(__docker_compose_services --filter status=running)
|
|
||||||
COMPREPLY=( $(compgen -W "$names" -- "$cur") )
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_build() {
|
|
||||||
case "$prev" in
|
|
||||||
--build-arg)
|
|
||||||
COMPREPLY=( $( compgen -e -- "$cur" ) )
|
|
||||||
__docker_compose_nospace
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
--memory|-m)
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--build-arg --compress --force-rm --help --memory -m --no-cache --no-rm --pull --parallel -q --quiet" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_services --filter source=build
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_bundle() {
|
|
||||||
case "$prev" in
|
|
||||||
--output|-o)
|
|
||||||
_filedir
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -W "--push-images --help --output -o" -- "$cur" ) )
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_config() {
|
|
||||||
case "$prev" in
|
|
||||||
--hash)
|
|
||||||
if [[ $cur == \\* ]] ; then
|
|
||||||
COMPREPLY=( '\*' )
|
|
||||||
else
|
|
||||||
COMPREPLY=( $(compgen -W "$(__docker_compose_services) \\\* " -- "$cur") )
|
|
||||||
fi
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -W "--hash --help --quiet -q --resolve-image-digests --services --volumes" -- "$cur" ) )
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_create() {
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--build --force-recreate --help --no-build --no-recreate" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_services
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_docker_compose() {
|
|
||||||
case "$prev" in
|
|
||||||
--tlscacert|--tlscert|--tlskey)
|
|
||||||
_filedir
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
--file|-f)
|
|
||||||
_filedir "y?(a)ml"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
--log-level)
|
|
||||||
COMPREPLY=( $( compgen -W "debug info warning error critical" -- "$cur" ) )
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
--project-directory)
|
|
||||||
_filedir -d
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
$(__docker_compose_to_extglob "$daemon_options_with_args") )
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "$daemon_boolean_options $daemon_options_with_args $top_level_options_with_args --help -h --no-ansi --verbose --version -v" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_down() {
|
|
||||||
case "$prev" in
|
|
||||||
--rmi)
|
|
||||||
COMPREPLY=( $( compgen -W "all local" -- "$cur" ) )
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
--timeout|-t)
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--help --rmi --timeout -t --volumes -v --remove-orphans" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_events() {
|
|
||||||
case "$prev" in
|
|
||||||
--json)
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--help --json" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_services
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_exec() {
|
|
||||||
case "$prev" in
|
|
||||||
--index|--user|-u|--workdir|-w)
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "-d --detach --help --index --privileged -T --user -u --workdir -w" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_running_services
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_help() {
|
|
||||||
COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) )
|
|
||||||
}
|
|
||||||
|
|
||||||
_docker_compose_images() {
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--help --quiet -q" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_services
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
_docker_compose_kill() {
|
|
||||||
case "$prev" in
|
|
||||||
-s)
|
|
||||||
COMPREPLY=( $( compgen -W "SIGHUP SIGINT SIGKILL SIGUSR1 SIGUSR2" -- "$(echo $cur | tr '[:lower:]' '[:upper:]')" ) )
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--help -s" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_running_services
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_logs() {
|
|
||||||
case "$prev" in
|
|
||||||
--tail)
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--follow -f --help --no-color --tail --timestamps -t" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_services
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_pause() {
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_running_services
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_port() {
|
|
||||||
case "$prev" in
|
|
||||||
--protocol)
|
|
||||||
COMPREPLY=( $( compgen -W "tcp udp" -- "$cur" ) )
|
|
||||||
return;
|
|
||||||
;;
|
|
||||||
--index)
|
|
||||||
return;
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--help --index --protocol" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_services
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_ps() {
|
|
||||||
local key=$(__docker_compose_map_key_of_current_option '--filter')
|
|
||||||
case "$key" in
|
|
||||||
source)
|
|
||||||
COMPREPLY=( $( compgen -W "build image" -- "${cur##*=}" ) )
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
status)
|
|
||||||
COMPREPLY=( $( compgen -W "paused restarting running stopped" -- "${cur##*=}" ) )
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$prev" in
|
|
||||||
--filter)
|
|
||||||
COMPREPLY=( $( compgen -W "source status" -S "=" -- "$cur" ) )
|
|
||||||
__docker_compose_nospace
|
|
||||||
return;
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--all -a --filter --help --quiet -q --services" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_services
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_pull() {
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--help --ignore-pull-failures --include-deps --no-parallel --quiet -q" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_services --filter source=image
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_push() {
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--help --ignore-push-failures" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_services
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_restart() {
|
|
||||||
case "$prev" in
|
|
||||||
--timeout|-t)
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--help --timeout -t" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_running_services
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_rm() {
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--force -f --help --stop -s -v" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if __docker_compose_has_option "--stop|-s" ; then
|
|
||||||
__docker_compose_complete_services
|
|
||||||
else
|
|
||||||
__docker_compose_complete_services --filter status=stopped
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_run() {
|
|
||||||
case "$prev" in
|
|
||||||
-e)
|
|
||||||
COMPREPLY=( $( compgen -e -- "$cur" ) )
|
|
||||||
__docker_compose_nospace
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
--entrypoint|--label|-l|--name|--user|-u|--volume|-v|--workdir|-w)
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--detach -d --entrypoint -e --help --label -l --name --no-deps --publish -p --rm --service-ports -T --use-aliases --user -u --volume -v --workdir -w" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_services
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_scale() {
|
|
||||||
case "$prev" in
|
|
||||||
=)
|
|
||||||
COMPREPLY=("$cur")
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
--timeout|-t)
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--help --timeout -t" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
COMPREPLY=( $(compgen -S "=" -W "$(__docker_compose_services)" -- "$cur") )
|
|
||||||
__docker_compose_nospace
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_start() {
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_services --filter status=stopped
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_stop() {
|
|
||||||
case "$prev" in
|
|
||||||
--timeout|-t)
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--help --timeout -t" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_running_services
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_top() {
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_running_services
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_unpause() {
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_services --filter status=paused
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_up() {
|
|
||||||
case "$prev" in
|
|
||||||
=)
|
|
||||||
COMPREPLY=("$cur")
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
--exit-code-from)
|
|
||||||
__docker_compose_complete_services
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
--scale)
|
|
||||||
COMPREPLY=( $(compgen -S "=" -W "$(__docker_compose_services)" -- "$cur") )
|
|
||||||
__docker_compose_nospace
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
--timeout|-t)
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--abort-on-container-exit --always-recreate-deps --build -d --detach --exit-code-from --force-recreate --help --no-build --no-color --no-deps --no-recreate --no-start --renew-anon-volumes -V --remove-orphans --scale --timeout -t" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__docker_compose_complete_services
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_version() {
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "--short" -- "$cur" ) )
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_docker_compose() {
|
|
||||||
local previous_extglob_setting=$(shopt -p extglob)
|
|
||||||
shopt -s extglob
|
|
||||||
|
|
||||||
local commands=(
|
|
||||||
build
|
|
||||||
bundle
|
|
||||||
config
|
|
||||||
create
|
|
||||||
down
|
|
||||||
events
|
|
||||||
exec
|
|
||||||
help
|
|
||||||
images
|
|
||||||
kill
|
|
||||||
logs
|
|
||||||
pause
|
|
||||||
port
|
|
||||||
ps
|
|
||||||
pull
|
|
||||||
push
|
|
||||||
restart
|
|
||||||
rm
|
|
||||||
run
|
|
||||||
scale
|
|
||||||
start
|
|
||||||
stop
|
|
||||||
top
|
|
||||||
unpause
|
|
||||||
up
|
|
||||||
version
|
|
||||||
)
|
|
||||||
|
|
||||||
# Options for the docker daemon that have to be passed to secondary calls to
|
|
||||||
# docker-compose executed by this script.
|
|
||||||
local daemon_boolean_options="
|
|
||||||
--skip-hostname-check
|
|
||||||
--tls
|
|
||||||
--tlsverify
|
|
||||||
"
|
|
||||||
local daemon_options_with_args="
|
|
||||||
--file -f
|
|
||||||
--host -H
|
|
||||||
--project-directory
|
|
||||||
--project-name -p
|
|
||||||
--tlscacert
|
|
||||||
--tlscert
|
|
||||||
--tlskey
|
|
||||||
"
|
|
||||||
|
|
||||||
# These options are require special treatment when searching the command.
|
|
||||||
local top_level_options_with_args="
|
|
||||||
--log-level
|
|
||||||
"
|
|
||||||
|
|
||||||
COMPREPLY=()
|
|
||||||
local cur prev words cword
|
|
||||||
_get_comp_words_by_ref -n : cur prev words cword
|
|
||||||
|
|
||||||
# search subcommand and invoke its handler.
|
|
||||||
# special treatment of some top-level options
|
|
||||||
local command='docker_compose'
|
|
||||||
local top_level_options=()
|
|
||||||
local counter=1
|
|
||||||
|
|
||||||
while [ $counter -lt $cword ]; do
|
|
||||||
case "${words[$counter]}" in
|
|
||||||
$(__docker_compose_to_extglob "$daemon_boolean_options") )
|
|
||||||
local opt=${words[counter]}
|
|
||||||
top_level_options+=($opt)
|
|
||||||
;;
|
|
||||||
$(__docker_compose_to_extglob "$daemon_options_with_args") )
|
|
||||||
local opt=${words[counter]}
|
|
||||||
local arg=${words[++counter]}
|
|
||||||
top_level_options+=($opt $arg)
|
|
||||||
;;
|
|
||||||
$(__docker_compose_to_extglob "$top_level_options_with_args") )
|
|
||||||
(( counter++ ))
|
|
||||||
;;
|
|
||||||
-*)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
command="${words[$counter]}"
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
(( counter++ ))
|
|
||||||
done
|
|
||||||
|
|
||||||
local completions_func=_docker_compose_${command//-/_}
|
|
||||||
declare -F $completions_func >/dev/null && $completions_func
|
|
||||||
|
|
||||||
eval "$previous_extglob_setting"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
eval "$__docker_compose_previous_extglob_setting"
|
|
||||||
unset __docker_compose_previous_extglob_setting
|
|
||||||
|
|
||||||
complete -F _docker_compose docker-compose docker-compose.exe
|
|
|
@ -1,3 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
_log_warning '"docker-machine" is now deprecated, and as such the bash completion for it is also deprecated.
|
|
||||||
Please disable this completion.'
|
|
|
@ -1,24 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
cite "about-completion"
|
|
||||||
about-completion "docker completion"
|
|
||||||
|
|
||||||
# Make sure docker is installed
|
|
||||||
_command_exists docker || return
|
|
||||||
|
|
||||||
# Don't handle completion if it's already managed
|
|
||||||
_completion_exists docker && return
|
|
||||||
|
|
||||||
_docker_bash_completion_paths=(
|
|
||||||
# MacOS
|
|
||||||
'/Applications/Docker.app/Contents/Resources/etc/docker.bash-completion'
|
|
||||||
# Linux
|
|
||||||
'/usr/share/bash-completion/completions/docker'
|
|
||||||
)
|
|
||||||
|
|
||||||
for fn in "${_docker_bash_completion_paths[@]}"; do
|
|
||||||
if [ -r "$fn" ]; then
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "$fn"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
|
@ -1,2 +0,0 @@
|
||||||
_log_warning 'Bash completion for "drush" is now deprecated, as it used code with incompatible license.
|
|
||||||
Please disable this completion and use the instructions from "drush" developers instead.'
|
|
|
@ -1 +0,0 @@
|
||||||
complete -o nospace -S = -W '$(printenv | awk -F= "{print \$1}")' export
|
|
|
@ -1,133 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# Bash completion support for Fabric (http://fabfile.org/)
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Copyright (C) 2011 by Konstantin Bakulin
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
#
|
|
||||||
# Thanks to:
|
|
||||||
# - Adam Vandenberg,
|
|
||||||
# https://github.com/adamv/dotfiles/blob/master/completion_scripts/fab_completion.bash
|
|
||||||
#
|
|
||||||
# - Enrico Batista da Luz,
|
|
||||||
# https://github.com/ricobl/dotfiles/blob/master/bin/fab_bash_completion
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
# Use cache files for fab tasks or not.
|
|
||||||
# If set to "false" command "fab --shortlist" will be executed every time.
|
|
||||||
export FAB_COMPLETION_CACHE_TASKS=true
|
|
||||||
|
|
||||||
# File name where tasks cache will be stored (in current dir).
|
|
||||||
export FAB_COMPLETION_CACHED_TASKS_FILENAME=".fab_tasks~"
|
|
||||||
|
|
||||||
|
|
||||||
# Set command to get time of last file modification as seconds since Epoch
|
|
||||||
case `uname` in
|
|
||||||
Darwin|FreeBSD)
|
|
||||||
__FAB_COMPLETION_MTIME_COMMAND="stat -f '%m'"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__FAB_COMPLETION_MTIME_COMMAND="stat -c '%Y'"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Get time of last fab cache file modification as seconds since Epoch
|
|
||||||
#
|
|
||||||
function __fab_chache_mtime() {
|
|
||||||
${__FAB_COMPLETION_MTIME_COMMAND} \
|
|
||||||
$FAB_COMPLETION_CACHED_TASKS_FILENAME | xargs -n 1 expr
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Get time of last fabfile file/module modification as seconds since Epoch
|
|
||||||
#
|
|
||||||
function __fab_fabfile_mtime() {
|
|
||||||
local f="fabfile"
|
|
||||||
if [[ -e "$f.py" ]]; then
|
|
||||||
${__FAB_COMPLETION_MTIME_COMMAND} "$f.py" | xargs -n 1 expr
|
|
||||||
else
|
|
||||||
# Suppose that it's a fabfile dir
|
|
||||||
find $f/*.py -exec ${__FAB_COMPLETION_MTIME_COMMAND} {} + \
|
|
||||||
| xargs -n 1 expr | sort -n -r | head -1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Completion for "fab" command
|
|
||||||
#
|
|
||||||
function __fab_completion() {
|
|
||||||
# Return if "fab" command doesn't exists
|
|
||||||
[[ -e `which fab 2> /dev/null` ]] || return 0
|
|
||||||
|
|
||||||
# Variables to hold the current word and possible matches
|
|
||||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
||||||
local opts=()
|
|
||||||
|
|
||||||
# Generate possible matches and store them in variable "opts"
|
|
||||||
case "${cur}" in
|
|
||||||
-*)
|
|
||||||
if [[ -z "${__FAB_COMPLETION_LONG_OPT}" ]]; then
|
|
||||||
export __FAB_COMPLETION_LONG_OPT=$(
|
|
||||||
fab --help | egrep -o "\-\-[A-Za-z_\-]+\=?" | sort -u)
|
|
||||||
fi
|
|
||||||
opts="${__FAB_COMPLETION_LONG_OPT}"
|
|
||||||
;;
|
|
||||||
|
|
||||||
# Completion for short options is not nessary.
|
|
||||||
# It's left here just for history.
|
|
||||||
# -*)
|
|
||||||
# if [[ -z "${__FAB_COMPLETION_SHORT_OPT}" ]]; then
|
|
||||||
# export __FAB_COMPLETION_SHORT_OPT=$(
|
|
||||||
# fab --help | egrep -o "^ +\-[A-Za-z_\]" | sort -u)
|
|
||||||
# fi
|
|
||||||
# opts="${__FAB_COMPLETION_SHORT_OPT}"
|
|
||||||
# ;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
# If "fabfile.py" or "fabfile" dir with "__init__.py" file exists
|
|
||||||
local f="fabfile"
|
|
||||||
if [[ -e "$f.py" || (-d "$f" && -e "$f/__init__.py") ]]; then
|
|
||||||
# Build a list of the available tasks
|
|
||||||
if $FAB_COMPLETION_CACHE_TASKS; then
|
|
||||||
# If use cache
|
|
||||||
if [[ ! -s ${FAB_COMPLETION_CACHED_TASKS_FILENAME} ||
|
|
||||||
$(__fab_fabfile_mtime) -gt $(__fab_chache_mtime) ]]; then
|
|
||||||
fab --shortlist > ${FAB_COMPLETION_CACHED_TASKS_FILENAME} \
|
|
||||||
2> /dev/null
|
|
||||||
fi
|
|
||||||
opts=$(cat ${FAB_COMPLETION_CACHED_TASKS_FILENAME})
|
|
||||||
else
|
|
||||||
# Without cache
|
|
||||||
opts=$(fab --shortlist 2> /dev/null)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Set possible completions
|
|
||||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
|
||||||
}
|
|
||||||
complete -o default -o nospace -F __fab_completion fab
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/usr/bin/bash
|
|
||||||
|
|
||||||
if _command_exists flutter; then
|
|
||||||
eval "$(flutter bash-completion)"
|
|
||||||
fi
|
|
|
@ -1,14 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
cite "about-completion"
|
|
||||||
about-completion "Google Cloud SDK completion"
|
|
||||||
|
|
||||||
if _command_exists gcloud; then
|
|
||||||
# get install path
|
|
||||||
GOOGLE_SDK_ROOT=${GOOGLE_SDK_ROOT:-$(gcloud info --format="value(installation.sdk_root)")}
|
|
||||||
|
|
||||||
# source all the bash completion file that are available
|
|
||||||
for i in "${GOOGLE_SDK_ROOT}"/*.bash.inc; do
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "$i"
|
|
||||||
done
|
|
||||||
fi
|
|
|
@ -1,35 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
cite "about-completion"
|
|
||||||
about-completion "gem completion"
|
|
||||||
|
|
||||||
__gem_completion() {
|
|
||||||
local cur=${COMP_WORDS[COMP_CWORD]}
|
|
||||||
local prev=${COMP_WORDS[COMP_CWORD - 1]}
|
|
||||||
case $prev in
|
|
||||||
install)
|
|
||||||
# list the remote gems and add to completion
|
|
||||||
if [ -z "$REMOTE_GEMS" ]; then
|
|
||||||
read -r -a REMOTE_GEMS <<< "$(gem list --remote --no-versions | sed 's/\*\*\* REMOTE GEMS \*\*\*//' | tr '\n' ' ')"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local cur=${COMP_WORDS[COMP_CWORD]}
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
COMPREPLY=($(compgen -W "${REMOTE_GEMS[*]}" -- "$cur"))
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
uninstall)
|
|
||||||
# list all local installed gems and add to completion
|
|
||||||
read -r -a LOCAL_GEMS <<< "$(gem list --no-versions | sed 's/\*\*\* LOCAL GEMS \*\*\*//' | tr '\n' ' ')"
|
|
||||||
|
|
||||||
local cur=${COMP_WORDS[COMP_CWORD]}
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
COMPREPLY=($(compgen -W "${LOCAL_GEMS[*]}" -- "$cur"))
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
local commands=(build cert check cleanup contents dependency environment fetch generate_index help install list lock outdated owner pristine push query rdoc search server sources specification stale uninstall unpack update which)
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
COMPREPLY=($(compgen -W "${commands[*]}" -- "$cur"))
|
|
||||||
}
|
|
||||||
|
|
||||||
complete -F __gem_completion gem
|
|
|
@ -1,39 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Only operate on MacOS since there are no linux paths
|
|
||||||
if [[ "$(uname -s)" != 'Darwin' ]] ; then
|
|
||||||
_log_warning "unsupported operating system - only 'Darwin' is supported"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make sure git is installed
|
|
||||||
_command_exists git || return 0
|
|
||||||
|
|
||||||
# Don't handle completion if it's already managed
|
|
||||||
if complete -p git &>/dev/null ; then
|
|
||||||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
_git_bash_completion_found=false
|
|
||||||
_git_bash_completion_paths=(
|
|
||||||
# MacOS non-system locations
|
|
||||||
'/Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash'
|
|
||||||
'/Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash'
|
|
||||||
)
|
|
||||||
|
|
||||||
# Load the first completion file found
|
|
||||||
for _comp_path in "${_git_bash_completion_paths[@]}" ; do
|
|
||||||
if [ -r "$_comp_path" ] ; then
|
|
||||||
_git_bash_completion_found=true
|
|
||||||
source "$_comp_path"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Cleanup
|
|
||||||
if [[ "${_git_bash_completion_found}" == false ]]; then
|
|
||||||
_log_warning "no completion files found - please try enabling the 'system' completion instead."
|
|
||||||
fi
|
|
||||||
unset _git_bash_completion_paths
|
|
||||||
unset _git_bash_completion_found
|
|
|
@ -1,177 +0,0 @@
|
||||||
#!bash
|
|
||||||
#
|
|
||||||
# git-flow-completion
|
|
||||||
# ===================
|
|
||||||
#
|
|
||||||
# Bash completion support for [git-flow](http://github.com/nvie/gitflow)
|
|
||||||
#
|
|
||||||
# The contained completion routines provide support for completing:
|
|
||||||
#
|
|
||||||
# * git-flow init and version
|
|
||||||
# * feature, hotfix and release branches
|
|
||||||
# * remote feature branch names (for `git-flow feature track`)
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Installation
|
|
||||||
# ------------
|
|
||||||
#
|
|
||||||
# To achieve git-flow completion nirvana:
|
|
||||||
#
|
|
||||||
# 0. Install git-completion.
|
|
||||||
#
|
|
||||||
# 1. Install this file. Either:
|
|
||||||
#
|
|
||||||
# a. Place it in a `bash-completion.d` folder:
|
|
||||||
#
|
|
||||||
# * /etc/bash-completion.d
|
|
||||||
# * /usr/local/etc/bash-completion.d
|
|
||||||
# * ~/bash-completion.d
|
|
||||||
#
|
|
||||||
# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.sh) and put the following line in
|
|
||||||
# your .bashrc:
|
|
||||||
#
|
|
||||||
# source ~/.git-flow-completion.sh
|
|
||||||
#
|
|
||||||
# 2. If you are using Git < 1.7.1: Edit git-completion.sh and add the following line to the giant
|
|
||||||
# $command case in _git:
|
|
||||||
#
|
|
||||||
# flow) _git_flow ;;
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# The Fine Print
|
|
||||||
# --------------
|
|
||||||
#
|
|
||||||
# Copyright (c) 2010 [Justin Hileman](http://justinhileman.com)
|
|
||||||
#
|
|
||||||
# Distributed under the [MIT License](http://creativecommons.org/licenses/MIT/)
|
|
||||||
|
|
||||||
_git_flow ()
|
|
||||||
{
|
|
||||||
local subcommands="init feature release hotfix"
|
|
||||||
local subcommand="$(__git_find_subcommand "$subcommands")"
|
|
||||||
if [ -z "$subcommand" ]; then
|
|
||||||
__gitcomp "$subcommands"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$subcommand" in
|
|
||||||
feature)
|
|
||||||
__git_flow_feature
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
release)
|
|
||||||
__git_flow_release
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
hotfix)
|
|
||||||
__git_flow_hotfix
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
COMPREPLY=()
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_feature ()
|
|
||||||
{
|
|
||||||
local subcommands="list start finish publish track diff rebase checkout pull"
|
|
||||||
local subcommand="$(__git_find_subcommand "$subcommands")"
|
|
||||||
if [ -z "$subcommand" ]; then
|
|
||||||
__gitcomp "$subcommands"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$subcommand" in
|
|
||||||
pull)
|
|
||||||
__gitcomp "$(__git_remotes)"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
checkout|finish|diff|rebase)
|
|
||||||
__gitcomp "$(__git_flow_list_features)"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
publish)
|
|
||||||
__gitcomp "$(comm -23 <(__git_flow_list_features) <(__git_flow_list_remote_features))"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
track)
|
|
||||||
__gitcomp "$(__git_flow_list_remote_features)"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
COMPREPLY=()
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_list_features ()
|
|
||||||
{
|
|
||||||
git flow feature list 2> /dev/null | tr -d ' |*'
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_list_remote_features ()
|
|
||||||
{
|
|
||||||
git branch -r 2> /dev/null | grep "origin/$(__git_flow_feature_prefix)" | awk '{ sub(/^origin\/$(__git_flow_feature_prefix)/, "", $1); print }'
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_feature_prefix ()
|
|
||||||
{
|
|
||||||
git config gitflow.prefix.feature 2> /dev/null || echo "feature/"
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_release ()
|
|
||||||
{
|
|
||||||
local subcommands="list start finish"
|
|
||||||
local subcommand="$(__git_find_subcommand "$subcommands")"
|
|
||||||
if [ -z "$subcommand" ]; then
|
|
||||||
__gitcomp "$subcommands"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$subcommand" in
|
|
||||||
finish)
|
|
||||||
__gitcomp "$(__git_flow_list_releases)"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
COMPREPLY=()
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_list_releases ()
|
|
||||||
{
|
|
||||||
git flow release list 2> /dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_hotfix ()
|
|
||||||
{
|
|
||||||
local subcommands="list start finish"
|
|
||||||
local subcommand="$(__git_find_subcommand "$subcommands")"
|
|
||||||
if [ -z "$subcommand" ]; then
|
|
||||||
__gitcomp "$subcommands"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$subcommand" in
|
|
||||||
finish)
|
|
||||||
__gitcomp "$(__git_flow_list_hotfixes)"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
COMPREPLY=()
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_list_hotfixes ()
|
|
||||||
{
|
|
||||||
git flow hotfix list 2> /dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
# temporarily wrap __git_find_on_cmdline() for backwards compatibility
|
|
||||||
if [ -z "`type -t __git_find_subcommand`" ]; then
|
|
||||||
alias __git_find_subcommand=__git_find_on_cmdline
|
|
||||||
fi
|
|
|
@ -1,510 +0,0 @@
|
||||||
#!bash
|
|
||||||
#
|
|
||||||
# git-flow-completion
|
|
||||||
# ===================
|
|
||||||
#
|
|
||||||
# Bash completion support for [git-flow (AVH Edition)](http://github.com/petervanderdoes/gitflow)
|
|
||||||
#
|
|
||||||
# The contained completion routines provide support for completing:
|
|
||||||
#
|
|
||||||
# * git-flow init and version
|
|
||||||
# * feature, hotfix and release branches
|
|
||||||
# * remote feature, hotfix and release branch names
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Installation
|
|
||||||
# ------------
|
|
||||||
#
|
|
||||||
# To achieve git-flow completion nirvana:
|
|
||||||
#
|
|
||||||
# 0. Install git-completion.
|
|
||||||
#
|
|
||||||
# 1. Install this file. Either:
|
|
||||||
#
|
|
||||||
# a. Place it in a `bash-completion.d` folder:
|
|
||||||
#
|
|
||||||
# * /etc/bash-completion.d
|
|
||||||
# * /usr/local/etc/bash-completion.d
|
|
||||||
# * ~/bash-completion.d
|
|
||||||
#
|
|
||||||
# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.sh) and put the following line in
|
|
||||||
# your .bashrc:
|
|
||||||
#
|
|
||||||
# source ~/.git-flow-completion.sh
|
|
||||||
#
|
|
||||||
# 2. If you are using Git < 1.7.1: Edit git-completion.sh and add the following line to the giant
|
|
||||||
# $command case in _git:
|
|
||||||
#
|
|
||||||
# flow) _git_flow ;;
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# The Fine Print
|
|
||||||
# --------------
|
|
||||||
#
|
|
||||||
# Author:
|
|
||||||
# Copyright 2012-2013 Peter van der Does.
|
|
||||||
#
|
|
||||||
# Original Author:
|
|
||||||
# Copyright (c) 2011 [Justin Hileman](http://justinhileman.com)
|
|
||||||
#
|
|
||||||
# Distributed under the [MIT License](http://creativecommons.org/licenses/MIT/)
|
|
||||||
|
|
||||||
__git_flow_config_file_options="
|
|
||||||
--local --global --system --file=
|
|
||||||
"
|
|
||||||
|
|
||||||
_git_flow ()
|
|
||||||
{
|
|
||||||
local subcommands="init feature release hotfix support help version config finish delete publish rebase"
|
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
|
||||||
if [ -z "$subcommand" ]; then
|
|
||||||
__gitcomp "$subcommands"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$subcommand" in
|
|
||||||
init)
|
|
||||||
__git_flow_init
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
feature)
|
|
||||||
__git_flow_feature
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
release)
|
|
||||||
__git_flow_release
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
hotfix)
|
|
||||||
__git_flow_hotfix
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
support)
|
|
||||||
__git_flow_support
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
config)
|
|
||||||
__git_flow_config
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
COMPREPLY=()
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_init ()
|
|
||||||
{
|
|
||||||
local subcommands="help"
|
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
|
||||||
if [ -z "$subcommand" ]; then
|
|
||||||
__gitcomp "$subcommands"
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "
|
|
||||||
--nodefaults --defaults
|
|
||||||
--noforce --force
|
|
||||||
$__git_flow_config_file_options
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_feature ()
|
|
||||||
{
|
|
||||||
local subcommands="list start finish publish track diff rebase checkout pull help delete"
|
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
|
||||||
|
|
||||||
if [ -z "$subcommand" ]; then
|
|
||||||
__gitcomp "$subcommands"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$subcommand" in
|
|
||||||
pull)
|
|
||||||
__gitcomp_nl "$(__git_remotes)"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
checkout)
|
|
||||||
__gitcomp_nl "$(__git_flow_list_local_branches 'feature')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
delete)
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "
|
|
||||||
--noforce --force
|
|
||||||
--noremote --remote
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
__gitcomp_nl "$(__git_flow_list_local_branches 'feature')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
finish)
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "
|
|
||||||
--nofetch --fetch
|
|
||||||
--norebase --rebase
|
|
||||||
--nopreserve-merges --preserve-merges
|
|
||||||
--nokeep --keep
|
|
||||||
--keepremote
|
|
||||||
--keeplocal
|
|
||||||
--noforce_delete --force_delete
|
|
||||||
--nosquash --squash
|
|
||||||
--no-ff
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
__gitcomp_nl "$(__git_flow_list_local_branches 'feature')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
diff)
|
|
||||||
__gitcomp_nl "$(__git_flow_list_local_branches 'feature')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
rebase)
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "
|
|
||||||
--nointeractive --interactive
|
|
||||||
--nopreserve-merges --preserve-merges
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
__gitcomp_nl "$(__git_flow_list_local_branches 'feature')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
publish)
|
|
||||||
__gitcomp_nl "$(__git_flow_list_branches 'feature')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
track)
|
|
||||||
__gitcomp_nl "$(__git_flow_list_branches 'feature')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
COMPREPLY=()
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_release ()
|
|
||||||
{
|
|
||||||
local subcommands="list start finish track publish help delete"
|
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
|
||||||
if [ -z "$subcommand" ]; then
|
|
||||||
__gitcomp "$subcommands"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$subcommand" in
|
|
||||||
finish)
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "
|
|
||||||
--nofetch --fetch
|
|
||||||
--sign
|
|
||||||
--signingkey
|
|
||||||
--message
|
|
||||||
--nomessagefile --messagefile=
|
|
||||||
--nopush --push
|
|
||||||
--nokeep --keep
|
|
||||||
--keepremote
|
|
||||||
--keeplocal
|
|
||||||
--noforce_delete --force_delete
|
|
||||||
--notag --tag
|
|
||||||
--nonobackmerge --nobackmerge
|
|
||||||
--nosquash --squash
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
__gitcomp_nl "$(__git_flow_list_local_branches 'release')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
rebase)
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "
|
|
||||||
--nointeractive --interactive
|
|
||||||
--nopreserve-merges --preserve-merges
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
__gitcomp_nl "$(__git_flow_list_local_branches 'release')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
delete)
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "
|
|
||||||
--noforce --force
|
|
||||||
--noremote --remote
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
__gitcomp_nl "$(__git_flow_list_local_branches 'release')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
publish)
|
|
||||||
__gitcomp_nl "$(__git_flow_list_branches 'release')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
track)
|
|
||||||
__gitcomp_nl "$(__git_flow_list_branches 'release')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
start)
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "
|
|
||||||
--nofetch --fetch
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
COMPREPLY=()
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_hotfix ()
|
|
||||||
{
|
|
||||||
local subcommands="list start finish track publish help delete"
|
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
|
||||||
if [ -z "$subcommand" ]; then
|
|
||||||
__gitcomp "$subcommands"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$subcommand" in
|
|
||||||
finish)
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "
|
|
||||||
--nofetch --fetch
|
|
||||||
--sign
|
|
||||||
--signingkey
|
|
||||||
--message
|
|
||||||
--nomessagefile --messagefile=
|
|
||||||
--nopush --push
|
|
||||||
--nokeep --keep
|
|
||||||
--keepremote
|
|
||||||
--keeplocal
|
|
||||||
--noforce_delete --force_delete
|
|
||||||
--notag --tag
|
|
||||||
--nonobackmerge --nobackmerge
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
__gitcomp_nl "$(__git_flow_list_local_branches 'hotfix')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
rebase)
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "
|
|
||||||
--nointeractive --interactive
|
|
||||||
--nopreserve-merges --preserve-merges
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
__gitcomp_nl "$(__git_flow_list_local_branches 'hotfix')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
delete)
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "
|
|
||||||
--noforce --force
|
|
||||||
--noremote --remote
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
__gitcomp_nl "$(__git_flow_list_local_branches 'hotfix')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
publish)
|
|
||||||
__gitcomp_nl "$(__git_flow_list_branches 'hotfix')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
track)
|
|
||||||
__gitcomp_nl "$(__git_flow_list_branches 'hotfix')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
start)
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "
|
|
||||||
--nofetch --fetch
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
COMPREPLY=()
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_support ()
|
|
||||||
{
|
|
||||||
local subcommands="list start help"
|
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
|
||||||
if [ -z "$subcommand" ]; then
|
|
||||||
__gitcomp "$subcommands"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$subcommand" in
|
|
||||||
start)
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "
|
|
||||||
--nofetch --fetch
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
rebase)
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "
|
|
||||||
--nointeractive --interactive
|
|
||||||
--nopreserve-merges --preserve-merges
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
__gitcomp_nl "$(__git_flow_list_local_branches 'support')"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
COMPREPLY=()
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_config ()
|
|
||||||
{
|
|
||||||
local subcommands="list set base"
|
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
|
||||||
if [ -z "$subcommand" ]; then
|
|
||||||
__gitcomp "$subcommands"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$subcommand" in
|
|
||||||
set)
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "
|
|
||||||
$__git_flow_config_file_options
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
__gitcomp "
|
|
||||||
master develop
|
|
||||||
feature hotfix release support
|
|
||||||
versiontagprefix
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
base)
|
|
||||||
case "$cur" in
|
|
||||||
--*)
|
|
||||||
__gitcomp "
|
|
||||||
set get
|
|
||||||
"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
__gitcomp_nl "$(__git_flow_list_local_branches)"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
COMPREPLY=()
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_prefix ()
|
|
||||||
{
|
|
||||||
case "$1" in
|
|
||||||
feature|release|hotfix|support)
|
|
||||||
git config "gitflow.prefix.$1" 2> /dev/null || echo "$1/"
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_list_local_branches ()
|
|
||||||
{
|
|
||||||
if [ -n "$1" ]; then
|
|
||||||
local prefix="$(__git_flow_prefix $1)"
|
|
||||||
git for-each-ref --shell --format="ref=%(refname:short)" refs/heads/$prefix | \
|
|
||||||
while read -r entry; do
|
|
||||||
eval "$entry"
|
|
||||||
ref="${ref#$prefix}"
|
|
||||||
echo "$ref"
|
|
||||||
done | sort
|
|
||||||
else
|
|
||||||
git for-each-ref --format="ref=%(refname:short)" refs/heads/ | sort
|
|
||||||
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_list_remote_branches ()
|
|
||||||
{
|
|
||||||
local prefix="$(__git_flow_prefix $1)"
|
|
||||||
local origin="$(git config gitflow.origin 2> /dev/null || echo "origin")"
|
|
||||||
git for-each-ref --shell --format='%(refname:short)' refs/remotes/$origin/$prefix | \
|
|
||||||
while read -r entry; do
|
|
||||||
eval "$entry"
|
|
||||||
ref="${ref##$prefix}"
|
|
||||||
echo "$ref"
|
|
||||||
done | sort
|
|
||||||
}
|
|
||||||
|
|
||||||
__git_flow_list_branches ()
|
|
||||||
{
|
|
||||||
local origin="$(git config gitflow.origin 2> /dev/null || echo "origin")"
|
|
||||||
if [ -n "$1" ]; then
|
|
||||||
local prefix="$(__git_flow_prefix $1)"
|
|
||||||
git for-each-ref --shell --format="ref=%(refname:short)" refs/heads/$prefix refs/remotes/$origin/$prefix | \
|
|
||||||
while read -r entry; do
|
|
||||||
eval "$entry"
|
|
||||||
ref="${ref##$prefix}"
|
|
||||||
echo "$ref"
|
|
||||||
done | sort
|
|
||||||
else
|
|
||||||
git for-each-ref --format="%(refname:short)" refs/heads/ refs/remotes/$origin | sort
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# alias __git_find_on_cmdline for backwards compatibility
|
|
||||||
if [ -z "`type -t __git_find_on_cmdline`" ]; then
|
|
||||||
alias __git_find_on_cmdline=__git_find_subcommand
|
|
||||||
fi
|
|
|
@ -1,9 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
cite "about-completion"
|
|
||||||
about-completion "GitHub CLI completion"
|
|
||||||
|
|
||||||
if _binary_exists gh; then
|
|
||||||
# If gh already completed, stop
|
|
||||||
_completion_exists gh && return
|
|
||||||
eval "$(gh completion --shell=bash)"
|
|
||||||
fi
|
|
|
@ -1,15 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
about-completion "completion for go command using gocomplete"
|
|
||||||
|
|
||||||
# bash completion for go tool
|
|
||||||
# https://github.com/posener/complete
|
|
||||||
|
|
||||||
# Test `go version` because goenv creates shim scripts that will be found in PATH
|
|
||||||
# but do not always resolve to a working install.
|
|
||||||
if _command_exists go && go version &> /dev/null; then
|
|
||||||
# Same idea here, but no need to test a subcommand
|
|
||||||
if _command_exists gocomplete && gocomplete &> /dev/null; then
|
|
||||||
# finally, apply completion
|
|
||||||
complete -C gocomplete go
|
|
||||||
fi
|
|
||||||
fi
|
|
|
@ -1,324 +0,0 @@
|
||||||
# Copyright (c) 2017 Eric Wendelin
|
|
||||||
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
# this software and associated documentation files (the "Software"), to deal in
|
|
||||||
# the Software without restriction, including without limitation the rights to
|
|
||||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
# of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
# so, subject to the following conditions:
|
|
||||||
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
|
|
||||||
# Bash breaks words on : by default. Subproject tasks have ':'
|
|
||||||
# Avoid inaccurate completions for subproject tasks
|
|
||||||
COMP_WORDBREAKS=$(echo "$COMP_WORDBREAKS" | sed -e 's/://g')
|
|
||||||
|
|
||||||
__gradle-set-project-root-dir() {
|
|
||||||
local dir=`pwd`
|
|
||||||
project_root_dir=`pwd`
|
|
||||||
while [[ $dir != '/' ]]; do
|
|
||||||
if [[ -f "$dir/settings.gradle" || -f "$dir/gradlew" ]]; then
|
|
||||||
project_root_dir=$dir
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
dir="$(dirname "$dir")"
|
|
||||||
done
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
__gradle-init-cache-dir() {
|
|
||||||
cache_dir="$HOME/.gradle/completion"
|
|
||||||
mkdir -p $cache_dir
|
|
||||||
}
|
|
||||||
|
|
||||||
__gradle-set-build-file() {
|
|
||||||
# Look for default build script in the settings file (settings.gradle by default)
|
|
||||||
# Otherwise, default is the file 'build.gradle' in the current directory.
|
|
||||||
gradle_build_file="$project_root_dir/build.gradle"
|
|
||||||
if [[ -f "$project_root_dir/settings.gradle" ]]; then
|
|
||||||
local build_file_name=$(grep "^rootProject\.buildFileName" "$project_root_dir/settings.gradle" | \
|
|
||||||
sed -n -e "s/rootProject\.buildFileName = [\'\"]\(.*\)[\'\"]/\1/p")
|
|
||||||
gradle_build_file="$project_root_dir/${build_file_name:-build.gradle}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
__gradle-set-cache-name() {
|
|
||||||
# Cache name is constructed from the absolute path of the build file.
|
|
||||||
cache_name=$(echo $gradle_build_file | sed -e 's/\//_/g')
|
|
||||||
}
|
|
||||||
|
|
||||||
__gradle-set-files-checksum() {
|
|
||||||
# Cache MD5 sum of all Gradle scripts and modified timestamps
|
|
||||||
if builtin command -v md5 > /dev/null; then
|
|
||||||
gradle_files_checksum=$(md5 -q -s "$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null)")
|
|
||||||
elif builtin command -v md5sum > /dev/null; then
|
|
||||||
gradle_files_checksum=$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null | md5sum | awk '{print $1}')
|
|
||||||
else
|
|
||||||
echo "Cannot generate completions as neither md5 nor md5sum exist on \$PATH"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
__gradle-generate-script-cache() {
|
|
||||||
# Invalidate cache after 3 weeks by default
|
|
||||||
local cache_ttl_mins=${GRADLE_CACHE_TTL_MINUTES:-30240}
|
|
||||||
local script_exclude_pattern=${GRADLE_COMPLETION_EXCLUDE_PATTERN:-"/(build|integTest|out)/"}
|
|
||||||
|
|
||||||
if [[ ! $(find $cache_dir/$cache_name -mmin -$cache_ttl_mins 2>/dev/null) ]]; then
|
|
||||||
# Cache all Gradle scripts
|
|
||||||
local gradle_build_scripts=$(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | egrep -v "$script_exclude_pattern")
|
|
||||||
printf "%s\n" "${gradle_build_scripts[@]}" > $cache_dir/$cache_name
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
__gradle-long-options() {
|
|
||||||
local args="--build-cache - Enables the Gradle build cache
|
|
||||||
--build-file - Specifies the build file
|
|
||||||
--configure-on-demand - Only relevant projects are configured
|
|
||||||
--console - Type of console output to generate (plain auto rich)
|
|
||||||
--continue - Continues task execution after a task failure
|
|
||||||
--continuous - Continuous mode. Automatically re-run build after changes
|
|
||||||
--daemon - Use the Gradle Daemon
|
|
||||||
--debug - Log at the debug level
|
|
||||||
--dry-run - Runs the build with all task actions disabled
|
|
||||||
--exclude-task - Specify a task to be excluded
|
|
||||||
--full-stacktrace - Print out the full (very verbose) stacktrace
|
|
||||||
--gradle-user-home - Specifies the Gradle user home directory
|
|
||||||
--gui - Launches the Gradle GUI app (Deprecated)
|
|
||||||
--help - Shows a help message
|
|
||||||
--include-build - Run the build as a composite, including the specified build
|
|
||||||
--info - Set log level to INFO
|
|
||||||
--init-script - Specifies an initialization script
|
|
||||||
--max-workers - Set the maximum number of workers that Gradle may use
|
|
||||||
--no-build-cache - Do not use the Gradle build cache
|
|
||||||
--no-daemon - Do not use the Gradle Daemon
|
|
||||||
--no-rebuild - Do not rebuild project dependencies
|
|
||||||
--no-scan - Do not create a build scan
|
|
||||||
--no-search-upwards - Do not search in parent directories for a settings.gradle
|
|
||||||
--offline - Build without accessing network resources
|
|
||||||
--parallel - Build projects in parallel
|
|
||||||
--profile - Profile build time and create report
|
|
||||||
--project-cache-dir - Specifies the project-specific cache directory
|
|
||||||
--project-dir - Specifies the start directory for Gradle
|
|
||||||
--project-prop - Sets a project property of the root project
|
|
||||||
--quiet - Log errors only
|
|
||||||
--recompile-scripts - Forces scripts to be recompiled, bypassing caching
|
|
||||||
--refresh-dependencies - Refresh the state of dependencies
|
|
||||||
--rerun-tasks - Specifies that any task optimization is ignored
|
|
||||||
--scan - Create a build scan
|
|
||||||
--settings-file - Specifies the settings file
|
|
||||||
--stacktrace - Print out the stacktrace also for user exceptions
|
|
||||||
--status - Print Gradle Daemon status
|
|
||||||
--stop - Stop all Gradle Daemons
|
|
||||||
--system-prop - Set a system property
|
|
||||||
--version - Prints Gradle version info
|
|
||||||
--warn - Log warnings and errors only"
|
|
||||||
COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") )
|
|
||||||
}
|
|
||||||
|
|
||||||
__gradle-properties() {
|
|
||||||
local args="-Dorg.gradle.cache.reserved.mb= - Reserve Gradle Daemon memory for operations
|
|
||||||
-Dorg.gradle.caching= - Set true to enable Gradle build cache
|
|
||||||
-Dorg.gradle.daemon.debug= - Set true to debug Gradle Daemon
|
|
||||||
-Dorg.gradle.daemon.idletimeout= - Kill Gradle Daemon after # idle millis
|
|
||||||
-Dorg.gradle.debug= - Set true to debug Gradle Client
|
|
||||||
-Dorg.gradle.jvmargs= - Set JVM arguments
|
|
||||||
-Dorg.gradle.java.home= - Set JDK home dir
|
|
||||||
-Dorg.gradle.logging.level= - Set default Gradle log level (quiet warn lifecycle info debug)
|
|
||||||
-Dorg.gradle.parallel= - Set true to enable parallel project builds (incubating)
|
|
||||||
-Dorg.gradle.parallel.intra= - Set true to enable intra-project parallel builds (incubating)
|
|
||||||
-Dorg.gradle.workers.max= - Set the number of workers Gradle is allowed to use"
|
|
||||||
COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") )
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
__gradle-short-options() {
|
|
||||||
local args="-? - Shows a help message
|
|
||||||
-a - Do not rebuild project dependencies
|
|
||||||
-b - Specifies the build file
|
|
||||||
-c - Specifies the settings file
|
|
||||||
-d - Log at the debug level
|
|
||||||
-g - Specifies the Gradle user home directory
|
|
||||||
-h - Shows a help message
|
|
||||||
-i - Set log level to INFO
|
|
||||||
-m - Runs the build with all task actions disabled
|
|
||||||
-p - Specifies the start directory for Gradle
|
|
||||||
-q - Log errors only
|
|
||||||
-s - Print out the stacktrace also for user exceptions
|
|
||||||
-t - Continuous mode. Automatically re-run build after changes
|
|
||||||
-u - Do not search in parent directories for a settings.gradle
|
|
||||||
-v - Prints Gradle version info
|
|
||||||
-w - Log warnings and errors only
|
|
||||||
-x - Specify a task to be excluded
|
|
||||||
-D - Set a system property
|
|
||||||
-I - Specifies an initialization script
|
|
||||||
-P - Sets a project property of the root project
|
|
||||||
-S - Print out the full (very verbose) stacktrace"
|
|
||||||
COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") )
|
|
||||||
}
|
|
||||||
|
|
||||||
__gradle-notify-tasks-cache-build() {
|
|
||||||
# Notify user of cache rebuild
|
|
||||||
echo -e " (Building completion cache. Please wait)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\c"
|
|
||||||
__gradle-generate-tasks-cache
|
|
||||||
# Remove "please wait" message by writing a bunch of spaces then moving back to the left
|
|
||||||
echo -e " \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\c"
|
|
||||||
}
|
|
||||||
|
|
||||||
__gradle-generate-tasks-cache() {
|
|
||||||
__gradle-set-files-checksum
|
|
||||||
|
|
||||||
# Use Gradle wrapper when it exists.
|
|
||||||
local gradle_cmd="gradle"
|
|
||||||
if [[ -x "$project_root_dir/gradlew" ]]; then
|
|
||||||
gradle_cmd="$project_root_dir/gradlew"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run gradle to retrieve possible tasks and cache.
|
|
||||||
# Reuse Gradle Daemon if IDLE but don't start a new one.
|
|
||||||
local gradle_tasks_output
|
|
||||||
if [[ ! -z "$($gradle_cmd --status 2>/dev/null | grep IDLE)" ]]; then
|
|
||||||
gradle_tasks_output="$($gradle_cmd -b $gradle_build_file --daemon -q tasks --all)"
|
|
||||||
else
|
|
||||||
gradle_tasks_output="$($gradle_cmd -b $gradle_build_file --no-daemon -q tasks --all)"
|
|
||||||
fi
|
|
||||||
local output_line
|
|
||||||
local task_description
|
|
||||||
local -a gradle_all_tasks=()
|
|
||||||
local -a root_tasks=()
|
|
||||||
local -a subproject_tasks=()
|
|
||||||
for output_line in $gradle_tasks_output; do
|
|
||||||
if [[ $output_line =~ ^([[:lower:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then
|
|
||||||
task_name="${BASH_REMATCH[1]}"
|
|
||||||
task_description="${BASH_REMATCH[3]}"
|
|
||||||
gradle_all_tasks+=( "$task_name - $task_description" )
|
|
||||||
# Completion for subproject tasks with ':' prefix
|
|
||||||
if [[ $task_name =~ ^([[:alnum:][:punct:]]+):([[:alnum:]]+) ]]; then
|
|
||||||
gradle_all_tasks+=( ":$task_name - $task_description" )
|
|
||||||
subproject_tasks+=( "${BASH_REMATCH[2]}" )
|
|
||||||
else
|
|
||||||
root_tasks+=( "$task_name" )
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# subproject tasks can be referenced implicitly from root project
|
|
||||||
if [[ $GRADLE_COMPLETION_UNQUALIFIED_TASKS == "true" ]]; then
|
|
||||||
local -a implicit_tasks=()
|
|
||||||
implicit_tasks=( $(comm -23 <(printf "%s\n" "${subproject_tasks[@]}" | sort) <(printf "%s\n" "${root_tasks[@]}" | sort)) )
|
|
||||||
for task in $(printf "%s\n" "${implicit_tasks[@]}"); do
|
|
||||||
gradle_all_tasks+=( $task )
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf "%s\n" "${gradle_all_tasks[@]}" > $cache_dir/$gradle_files_checksum
|
|
||||||
echo $gradle_files_checksum > $cache_dir/$cache_name.md5
|
|
||||||
}
|
|
||||||
|
|
||||||
__gradle-completion-init() {
|
|
||||||
local cache_dir cache_name gradle_build_file gradle_files_checksum project_root_dir
|
|
||||||
|
|
||||||
local OLDIFS="$IFS"
|
|
||||||
local IFS=$'\n'
|
|
||||||
|
|
||||||
__gradle-init-cache-dir
|
|
||||||
__gradle-set-project-root-dir
|
|
||||||
__gradle-set-build-file
|
|
||||||
if [[ -f $gradle_build_file ]]; then
|
|
||||||
__gradle-set-cache-name
|
|
||||||
__gradle-generate-script-cache
|
|
||||||
__gradle-set-files-checksum
|
|
||||||
__gradle-notify-tasks-cache-build
|
|
||||||
fi
|
|
||||||
|
|
||||||
IFS="$OLDIFS"
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
_gradle() {
|
|
||||||
local cache_dir cache_name gradle_build_file gradle_files_checksum project_root_dir
|
|
||||||
local cur=${COMP_WORDS[COMP_CWORD]}
|
|
||||||
# Set bash internal field separator to '\n'
|
|
||||||
# This allows us to provide descriptions for options and tasks
|
|
||||||
local OLDIFS="$IFS"
|
|
||||||
local IFS=$'\n'
|
|
||||||
|
|
||||||
if [[ ${cur} == --* ]]; then
|
|
||||||
__gradle-long-options
|
|
||||||
elif [[ ${cur} == -D* ]]; then
|
|
||||||
__gradle-properties
|
|
||||||
elif [[ ${cur} == -* ]]; then
|
|
||||||
__gradle-short-options
|
|
||||||
else
|
|
||||||
__gradle-init-cache-dir
|
|
||||||
__gradle-set-project-root-dir
|
|
||||||
__gradle-set-build-file
|
|
||||||
if [[ -f $gradle_build_file ]]; then
|
|
||||||
__gradle-set-cache-name
|
|
||||||
__gradle-generate-script-cache
|
|
||||||
__gradle-set-files-checksum
|
|
||||||
|
|
||||||
# The cache key is md5 sum of all gradle scripts, so it's valid if it exists.
|
|
||||||
if [[ -f $cache_dir/$cache_name.md5 ]]; then
|
|
||||||
local cached_checksum="$(cat $cache_dir/$cache_name.md5)"
|
|
||||||
local -a cached_tasks
|
|
||||||
if [[ -z $cur ]]; then
|
|
||||||
cached_tasks=( $(cat $cache_dir/$cached_checksum) )
|
|
||||||
else
|
|
||||||
cached_tasks=( $(grep "^$cur" $cache_dir/$cached_checksum) )
|
|
||||||
fi
|
|
||||||
COMPREPLY=( $(compgen -W "${cached_tasks[*]}" -- "$cur") )
|
|
||||||
else
|
|
||||||
__gradle-notify-tasks-cache-build
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Regenerate tasks cache in the background
|
|
||||||
if [[ $gradle_files_checksum != "$(cat $cache_dir/$cache_name.md5)" || ! -f $cache_dir/$gradle_files_checksum ]]; then
|
|
||||||
$(__gradle-generate-tasks-cache 1>&2 2>/dev/null &)
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# Default tasks available outside Gradle projects
|
|
||||||
local args="buildEnvironment - Displays all buildscript dependencies declared in root project.
|
|
||||||
components - Displays the components produced by root project.
|
|
||||||
dependencies - Displays all dependencies declared in root project.
|
|
||||||
dependencyInsight - Displays the insight into a specific dependency in root project.
|
|
||||||
dependentComponents - Displays the dependent components of components in root project.
|
|
||||||
help - Displays a help message.
|
|
||||||
init - Initializes a new Gradle build.
|
|
||||||
model - Displays the configuration model of root project.
|
|
||||||
projects - Displays the sub-projects of root project.
|
|
||||||
properties - Displays the properties of root project.
|
|
||||||
tasks - Displays the tasks runnable from root project.
|
|
||||||
wrapper - Generates Gradle wrapper files."
|
|
||||||
COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") )
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
IFS="$OLDIFS"
|
|
||||||
|
|
||||||
# Remove description ("[:space:]" and after) if only one possibility
|
|
||||||
if [[ ${#COMPREPLY[*]} -eq 1 ]]; then
|
|
||||||
COMPREPLY=( ${COMPREPLY[0]%% *} )
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
complete -F _gradle gradle
|
|
||||||
complete -F _gradle gradle.bat
|
|
||||||
complete -F _gradle gradlew
|
|
||||||
complete -F _gradle gradlew.bat
|
|
||||||
complete -F _gradle ./gradlew
|
|
||||||
complete -F _gradle ./gradlew.bat
|
|
||||||
|
|
||||||
if hash gw 2>/dev/null || alias gw >/dev/null 2>&1; then
|
|
||||||
complete -F _gradle gw
|
|
||||||
fi
|
|
|
@ -1,75 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# grunt-cli
|
|
||||||
# http://gruntjs.com/
|
|
||||||
#
|
|
||||||
# Copyright jQuery Foundation and other contributors, https://jquery.org/
|
|
||||||
|
|
||||||
# This software consists of voluntary contributions made by many
|
|
||||||
# individuals. For exact contribution history, see the revision history
|
|
||||||
# available at https://github.com/gruntjs/grunt .
|
|
||||||
|
|
||||||
# The following license applies to all parts of this software except as
|
|
||||||
# documented below:
|
|
||||||
|
|
||||||
# ====
|
|
||||||
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
# a copy of this software and associated documentation files (the
|
|
||||||
# "Software"), to deal in the Software without restriction, including
|
|
||||||
# without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
# permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
# the following conditions:
|
|
||||||
|
|
||||||
# The above copyright notice and this permission notice shall be
|
|
||||||
# included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
# Usage:
|
|
||||||
#
|
|
||||||
# To enable bash <tab> completion for grunt, add the following line (minus the
|
|
||||||
# leading #, which is the bash comment character) to your ~/.bashrc file:
|
|
||||||
#
|
|
||||||
# eval "$(grunt --completion=bash)"
|
|
||||||
|
|
||||||
# Search the current directory and all parent directories for a gruntfile.
|
|
||||||
function _grunt_gruntfile() {
|
|
||||||
local curpath="$PWD"
|
|
||||||
while [[ "$curpath" ]]; do
|
|
||||||
for gruntfile in "$curpath/"{G,g}runtfile.{js,coffee}; do
|
|
||||||
if [[ -e "$gruntfile" ]]; then
|
|
||||||
echo "$gruntfile"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
curpath="${curpath%/*}"
|
|
||||||
done
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Enable bash autocompletion.
|
|
||||||
function _grunt_completions() {
|
|
||||||
# The currently-being-completed word.
|
|
||||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
||||||
# The current gruntfile, if it exists.
|
|
||||||
local gruntfile="$(_grunt_gruntfile)"
|
|
||||||
# The current grunt version, available tasks, options, etc.
|
|
||||||
local gruntinfo="$(grunt --version --verbose 2>/dev/null)"
|
|
||||||
# Options and tasks.
|
|
||||||
local opts="$(echo "$gruntinfo" | awk '/Available options: / {$1=$2=""; print $0}')"
|
|
||||||
local compls="$(echo "$gruntinfo" | awk '/Available tasks: / {$1=$2=""; print $0}')"
|
|
||||||
# Only add -- or - options if the user has started typing -
|
|
||||||
[[ "$cur" == -* ]] && compls="$compls $opts"
|
|
||||||
# Tell complete what stuff to show.
|
|
||||||
COMPREPLY=($(compgen -W "$compls" -- "$cur"))
|
|
||||||
}
|
|
||||||
|
|
||||||
complete -o default -F _grunt_completions grunt
|
|
|
@ -1,50 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# Borrowed from grunt-cli
|
|
||||||
# http://gruntjs.com/
|
|
||||||
#
|
|
||||||
# Copyright jQuery Foundation and other contributors, https://jquery.org/
|
|
||||||
|
|
||||||
# This software consists of voluntary contributions made by many
|
|
||||||
# individuals. For exact contribution history, see the revision history
|
|
||||||
# available at https://github.com/gruntjs/grunt .
|
|
||||||
|
|
||||||
# The following license applies to all parts of this software except as
|
|
||||||
# documented below:
|
|
||||||
|
|
||||||
# ====
|
|
||||||
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
# a copy of this software and associated documentation files (the
|
|
||||||
# "Software"), to deal in the Software without restriction, including
|
|
||||||
# without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
# permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
# the following conditions:
|
|
||||||
|
|
||||||
# The above copyright notice and this permission notice shall be
|
|
||||||
# included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
# Usage:
|
|
||||||
#
|
|
||||||
# To enable bash <tab> completion for gulp, add the following line (minus the
|
|
||||||
# leading #, which is the bash comment character) to your ~/.bashrc file:
|
|
||||||
#
|
|
||||||
# eval "$(gulp --completion=bash)"
|
|
||||||
# Enable bash autocompletion.
|
|
||||||
function _gulp_completions() {
|
|
||||||
# The currently-being-completed word.
|
|
||||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
||||||
#Grab tasks
|
|
||||||
local compls=$(gulp --tasks-simple)
|
|
||||||
# Tell complete what stuff to show.
|
|
||||||
COMPREPLY=($(compgen -W "$compls" -- "$cur"))
|
|
||||||
}
|
|
||||||
complete -o default -F _gulp_completions gulp
|
|
|
@ -1,7 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
cite "about-completion"
|
|
||||||
about-completion "helm (Kubernetes Package Manager) completion"
|
|
||||||
|
|
||||||
if _command_exists helm; then
|
|
||||||
eval "$(helm completion bash)"
|
|
||||||
fi
|
|
|
@ -1,2 +0,0 @@
|
||||||
_log_warning 'Bash completion for "homesick" is now deprecated, as it used unlicensed code.
|
|
||||||
Please disable this completion and use the instructions from "homesick" bash completion developers instead.'
|
|
|
@ -1,408 +0,0 @@
|
||||||
# hub tab-completion script for bash.
|
|
||||||
# This script complements the completion script that ships with git.
|
|
||||||
|
|
||||||
# Copyright (c) 2009 Chris Wanstrath
|
|
||||||
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
# a copy of this software and associated documentation files (the
|
|
||||||
# "Software"), to deal in the Software without restriction, including
|
|
||||||
# without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
# permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
# the following conditions:
|
|
||||||
|
|
||||||
# The above copyright notice and this permission notice shall be
|
|
||||||
# included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
# If there is no git tab completion, but we have the _completion loader try to load it
|
|
||||||
if ! declare -F _git > /dev/null && declare -F _completion_loader > /dev/null; then
|
|
||||||
_completion_loader git
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check that git tab completion is available and we haven't already set up completion
|
|
||||||
if declare -F _git > /dev/null && ! declare -F __git_list_all_commands_without_hub > /dev/null; then
|
|
||||||
# Duplicate and rename the 'list_all_commands' function
|
|
||||||
eval "$(declare -f __git_list_all_commands | \
|
|
||||||
sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')"
|
|
||||||
|
|
||||||
# Wrap the 'list_all_commands' function with extra hub commands
|
|
||||||
__git_list_all_commands() {
|
|
||||||
cat <<-EOF
|
|
||||||
alias
|
|
||||||
pull-request
|
|
||||||
pr
|
|
||||||
issue
|
|
||||||
release
|
|
||||||
fork
|
|
||||||
create
|
|
||||||
delete
|
|
||||||
browse
|
|
||||||
compare
|
|
||||||
ci-status
|
|
||||||
sync
|
|
||||||
EOF
|
|
||||||
__git_list_all_commands_without_hub
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ensure cached commands are cleared
|
|
||||||
__git_all_commands=""
|
|
||||||
|
|
||||||
##########################
|
|
||||||
# hub command completions
|
|
||||||
##########################
|
|
||||||
|
|
||||||
# hub alias [-s] [SHELL]
|
|
||||||
_git_alias() {
|
|
||||||
local i c=2 s=-s sh shells="bash zsh sh ksh csh fish"
|
|
||||||
while [ $c -lt $cword ]; do
|
|
||||||
i="${words[c]}"
|
|
||||||
case "$i" in
|
|
||||||
-s)
|
|
||||||
unset s
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
for sh in $shells; do
|
|
||||||
if [ "$sh" = "$i" ]; then
|
|
||||||
unset shells
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
((c++))
|
|
||||||
done
|
|
||||||
__gitcomp "$s $shells"
|
|
||||||
}
|
|
||||||
|
|
||||||
# hub browse [-u] [--|[USER/]REPOSITORY] [SUBPAGE]
|
|
||||||
_git_browse() {
|
|
||||||
local i c=2 u=-u repo subpage
|
|
||||||
local subpages_="commits issues tree wiki pulls branches stargazers
|
|
||||||
contributors network network/ graphs graphs/"
|
|
||||||
local subpages_network="members"
|
|
||||||
local subpages_graphs="commit-activity code-frequency punch-card"
|
|
||||||
while [ $c -lt $cword ]; do
|
|
||||||
i="${words[c]}"
|
|
||||||
case "$i" in
|
|
||||||
-u)
|
|
||||||
unset u
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [ -z "$repo" ]; then
|
|
||||||
repo=$i
|
|
||||||
else
|
|
||||||
subpage=$i
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
((c++))
|
|
||||||
done
|
|
||||||
if [ -z "$repo" ]; then
|
|
||||||
__gitcomp "$u -- $(__hub_github_repos '\p')"
|
|
||||||
elif [ -z "$subpage" ]; then
|
|
||||||
case "$cur" in
|
|
||||||
*/*)
|
|
||||||
local pfx="${cur%/*}" cur_="${cur#*/}"
|
|
||||||
local subpages_var="subpages_$pfx"
|
|
||||||
__gitcomp "${!subpages_var}" "$pfx/" "$cur_"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__gitcomp "$u ${subpages_}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
__gitcomp "$u"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# hub compare [-u] [USER[/REPOSITORY]] [[START...]END]
|
|
||||||
_git_compare() {
|
|
||||||
local i c=$((cword - 1)) u=-u user remote owner repo arg_repo rev
|
|
||||||
while [ $c -gt 1 ]; do
|
|
||||||
i="${words[c]}"
|
|
||||||
case "$i" in
|
|
||||||
-u)
|
|
||||||
unset u
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [ -z "$rev" ]; then
|
|
||||||
# Even though the logic below is able to complete both user/repo
|
|
||||||
# and revision in the right place, when there is only one argument
|
|
||||||
# (other than -u) in the command, that argument will be taken as
|
|
||||||
# revision. For example:
|
|
||||||
# $ hub compare -u upstream
|
|
||||||
# > https://github.com/USER/REPO/compare/upstream
|
|
||||||
if __hub_github_repos '\p' | grep -Eqx "^$i(/[^/]+)?"; then
|
|
||||||
arg_repo=$i
|
|
||||||
else
|
|
||||||
rev=$i
|
|
||||||
fi
|
|
||||||
elif [ -z "$arg_repo" ]; then
|
|
||||||
arg_repo=$i
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
((c--))
|
|
||||||
done
|
|
||||||
|
|
||||||
# Here we want to find out the git remote name of user/repo, in order to
|
|
||||||
# generate an appropriate revision list
|
|
||||||
if [ -z "$arg_repo" ]; then
|
|
||||||
user=$(__hub_github_user)
|
|
||||||
if [ -z "$user" ]; then
|
|
||||||
for i in $(__hub_github_repos); do
|
|
||||||
remote=${i%%:*}
|
|
||||||
repo=${i#*:}
|
|
||||||
if [ "$remote" = origin ]; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
else
|
|
||||||
for i in $(__hub_github_repos); do
|
|
||||||
remote=${i%%:*}
|
|
||||||
repo=${i#*:}
|
|
||||||
owner=${repo%%/*}
|
|
||||||
if [ "$user" = "$owner" ]; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
for i in $(__hub_github_repos); do
|
|
||||||
remote=${i%%:*}
|
|
||||||
repo=${i#*:}
|
|
||||||
owner=${repo%%/*}
|
|
||||||
case "$arg_repo" in
|
|
||||||
"$repo"|"$owner")
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
local pfx cur_="$cur"
|
|
||||||
case "$cur_" in
|
|
||||||
*..*)
|
|
||||||
pfx="${cur_%%..*}..."
|
|
||||||
cur_="${cur_##*..}"
|
|
||||||
__gitcomp_nl "$(__hub_revlist $remote)" "$pfx" "$cur_"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [ -z "${arg_repo}${rev}" ]; then
|
|
||||||
__gitcomp "$u $(__hub_github_repos '\o\n\p') $(__hub_revlist $remote)"
|
|
||||||
elif [ -z "$rev" ]; then
|
|
||||||
__gitcomp "$u $(__hub_revlist $remote)"
|
|
||||||
else
|
|
||||||
__gitcomp "$u"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# hub create [NAME] [-p] [-d DESCRIPTION] [-h HOMEPAGE]
|
|
||||||
_git_create() {
|
|
||||||
local i c=2 name repo flags="-p -d -h"
|
|
||||||
while [ $c -lt $cword ]; do
|
|
||||||
i="${words[c]}"
|
|
||||||
case "$i" in
|
|
||||||
-d|-h)
|
|
||||||
((c++))
|
|
||||||
flags=${flags/$i/}
|
|
||||||
;;
|
|
||||||
-p)
|
|
||||||
flags=${flags/$i/}
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
name=$i
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
((c++))
|
|
||||||
done
|
|
||||||
if [ -z "$name" ]; then
|
|
||||||
repo=$(basename "$(pwd)")
|
|
||||||
fi
|
|
||||||
case "$prev" in
|
|
||||||
-d|-h)
|
|
||||||
COMPREPLY=()
|
|
||||||
;;
|
|
||||||
-p|*)
|
|
||||||
__gitcomp "$repo $flags"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# hub fork [--no-remote] [--remote-name REMOTE] [--org ORGANIZATION]
|
|
||||||
_git_fork() {
|
|
||||||
local i c=2 flags="--no-remote --remote-name --org"
|
|
||||||
while [ $c -lt $cword ]; do
|
|
||||||
i="${words[c]}"
|
|
||||||
case "$i" in
|
|
||||||
--org)
|
|
||||||
((c++))
|
|
||||||
flags=${flags/$i/}
|
|
||||||
;;
|
|
||||||
--remote-name)
|
|
||||||
((c++))
|
|
||||||
flags=${flags/$i/}
|
|
||||||
flags=${flags/--no-remote/}
|
|
||||||
;;
|
|
||||||
--no-remote)
|
|
||||||
flags=${flags/$i/}
|
|
||||||
flags=${flags/--remote-name/}
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
((c++))
|
|
||||||
done
|
|
||||||
case "$prev" in
|
|
||||||
--remote-name|--org)
|
|
||||||
COMPREPLY=()
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__gitcomp "$flags"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# hub pull-request [-f] [-m <MESSAGE>|-F <FILE>|-i <ISSUE>|<ISSUE-URL>] [-b <BASE>] [-h <HEAD>] [-a <USER>] [-M <MILESTONE>] [-l <LABELS>]
|
|
||||||
_git_pull_request() {
|
|
||||||
local i c=2 flags="-f -m -F -i -b -h -a -M -l"
|
|
||||||
while [ $c -lt $cword ]; do
|
|
||||||
i="${words[c]}"
|
|
||||||
case "$i" in
|
|
||||||
-m|-F|-i|-b|-h|-a|-M|-l)
|
|
||||||
((c++))
|
|
||||||
flags=${flags/$i/}
|
|
||||||
;;
|
|
||||||
-f)
|
|
||||||
flags=${flags/$i/}
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
((c++))
|
|
||||||
done
|
|
||||||
case "$prev" in
|
|
||||||
-i)
|
|
||||||
COMPREPLY=()
|
|
||||||
;;
|
|
||||||
-b|-h|-a|-M|-l)
|
|
||||||
# (Doesn't seem to need this...)
|
|
||||||
# Uncomment the following line when 'owner/repo:[TAB]' misbehaved
|
|
||||||
#_get_comp_words_by_ref -n : cur
|
|
||||||
__gitcomp_nl "$(__hub_heads)"
|
|
||||||
# __ltrim_colon_completions "$cur"
|
|
||||||
;;
|
|
||||||
-F)
|
|
||||||
COMPREPLY=( "$cur"* )
|
|
||||||
;;
|
|
||||||
-f|*)
|
|
||||||
__gitcomp "$flags"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
###################
|
|
||||||
# Helper functions
|
|
||||||
###################
|
|
||||||
|
|
||||||
# __hub_github_user [HOST]
|
|
||||||
# Return $GITHUB_USER or the default github user defined in hub config
|
|
||||||
# HOST - Host to be looked-up in hub config. Default is "github.com"
|
|
||||||
__hub_github_user() {
|
|
||||||
if [ -n "$GITHUB_USER" ]; then
|
|
||||||
echo $GITHUB_USER
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
local line h k v host=${1:-github.com} config=${HUB_CONFIG:-~/.config/hub}
|
|
||||||
if [ -f "$config" ]; then
|
|
||||||
while read line; do
|
|
||||||
if [ "$line" = "---" ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
k=${line%%:*}
|
|
||||||
v=${line#*:}
|
|
||||||
if [ -z "$v" ]; then
|
|
||||||
if [ "$h" = "$host" ]; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
h=$k
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
k=${k#* }
|
|
||||||
v=${v#* }
|
|
||||||
if [ "$h" = "$host" ] && [ "$k" = "user" ]; then
|
|
||||||
echo "$v"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done < "$config"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# __hub_github_repos [FORMAT]
|
|
||||||
# List all github hosted repository
|
|
||||||
# FORMAT - Format string contains multiple of these:
|
|
||||||
# \m remote
|
|
||||||
# \p owner/repo
|
|
||||||
# \o owner
|
|
||||||
# escaped characters (\n, \t ...etc) work
|
|
||||||
# If omitted, prints all github repos in the format of "remote:owner/repo"
|
|
||||||
__hub_github_repos() {
|
|
||||||
local f format=$1
|
|
||||||
if [ -z "$(__gitdir)" ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
if [ -z "$format" ]; then
|
|
||||||
format='\1:\2'
|
|
||||||
else
|
|
||||||
format=${format//\m/\1}
|
|
||||||
format=${format//\p/\2}
|
|
||||||
format=${format//\o/\3}
|
|
||||||
fi
|
|
||||||
command git config --get-regexp 'remote\.[^.]*\.url' |
|
|
||||||
grep -E ' ((https?|git)://|git@)github\.com[:/][^:/]+/[^/]+$' |
|
|
||||||
sed -E 's#^remote\.([^.]+)\.url +.+[:/](([^/]+)/[^.]+)(\.git)?$#'"$format"'#'
|
|
||||||
}
|
|
||||||
|
|
||||||
# __hub_heads
|
|
||||||
# List all local "branch", and remote "owner/repo:branch"
|
|
||||||
__hub_heads() {
|
|
||||||
local i remote repo branch dir=$(__gitdir)
|
|
||||||
if [ -d "$dir" ]; then
|
|
||||||
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
|
||||||
"refs/heads/"
|
|
||||||
for i in $(__hub_github_repos); do
|
|
||||||
remote=${i%%:*}
|
|
||||||
repo=${i#*:}
|
|
||||||
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
|
||||||
"refs/remotes/${remote}/" | while read branch; do
|
|
||||||
echo "${repo}:${branch#${remote}/}"
|
|
||||||
done
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# __hub_revlist [REMOTE]
|
|
||||||
# List all tags, and branches under REMOTE, without the "remote/" prefix
|
|
||||||
# REMOTE - Remote name to search branches from. Default is "origin"
|
|
||||||
__hub_revlist() {
|
|
||||||
local i remote=${1:-origin} dir=$(__gitdir)
|
|
||||||
if [ -d "$dir" ]; then
|
|
||||||
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
|
||||||
"refs/remotes/${remote}/" | while read i; do
|
|
||||||
echo "${i#${remote}/}"
|
|
||||||
done
|
|
||||||
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
|
||||||
"refs/tags/"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Enable completion for hub even when not using the alias
|
|
||||||
complete -o bashdefault -o default -o nospace -F _git hub 2>/dev/null \
|
|
||||||
|| complete -o default -o nospace -F _git hub
|
|
||||||
fi
|
|
|
@ -1,54 +0,0 @@
|
||||||
# Invoke (pyinvoke.org) tab-completion script to be sourced with Bash shell.
|
|
||||||
|
|
||||||
# Copyright (c) 2020 Jeff Forcier.
|
|
||||||
# All rights reserved.
|
|
||||||
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
# * Redistributions of source code must retain the above copyright notice,
|
|
||||||
# this list of conditions and the following disclaimer.
|
|
||||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
# this list of conditions and the following disclaimer in the documentation
|
|
||||||
# and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
# https://github.com/pyinvoke/invoke/blob/master/completion/bash
|
|
||||||
|
|
||||||
_complete_invoke() {
|
|
||||||
local candidates
|
|
||||||
|
|
||||||
# COMP_WORDS contains the entire command string up til now (including
|
|
||||||
# program name).
|
|
||||||
# We hand it to Invoke so it can figure out the current context: spit back
|
|
||||||
# core options, task names, the current task's options, or some combo.
|
|
||||||
candidates=`invoke --complete -- ${COMP_WORDS[*]}`
|
|
||||||
|
|
||||||
# `compgen -W` takes list of valid options & a partial word & spits back
|
|
||||||
# possible matches. Necessary for any partial word completions (vs
|
|
||||||
# completions performed when no partial words are present).
|
|
||||||
#
|
|
||||||
# $2 is the current word or token being tabbed on, either empty string or a
|
|
||||||
# partial word, and thus wants to be compgen'd to arrive at some subset of
|
|
||||||
# our candidate list which actually matches.
|
|
||||||
#
|
|
||||||
# COMPREPLY is the list of valid completions handed back to `complete`.
|
|
||||||
COMPREPLY=( $(compgen -W "${candidates}" -- $2) )
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Tell shell builtin to use the above for completing 'inv'/'invoke':
|
|
||||||
# * -F: use given function name to generate completions.
|
|
||||||
# * -o default: when function generates no results, use filenames.
|
|
||||||
# * positional args: program names to complete for.
|
|
||||||
complete -F _complete_invoke -o default invoke inv
|
|
|
@ -1,4 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
about-completion "jboss5 completion"
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "${BASH_IT}"/vendor/github.com/rparree/jboss-bash-completion/jboss5
|
|
|
@ -1,4 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
about-completion "jboss7 completion"
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "${BASH_IT}"/vendor/github.com/rparree/jboss-bash-completion/jboss7
|
|
|
@ -1,7 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
cite "about-completion"
|
|
||||||
about-completion "jungle(AWS cli tool) completion"
|
|
||||||
|
|
||||||
if _command_exists jungle; then
|
|
||||||
eval "$(_JUNGLE_COMPLETE=source jungle)"
|
|
||||||
fi
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
if _command_exists kind; then
|
|
||||||
eval "$(kind completion bash)"
|
|
||||||
fi
|
|
|
@ -1,201 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
|
|
||||||
# Published originally as public domain code at https://github.com/wk8/knife-bash-autocomplete
|
|
||||||
|
|
||||||
##############
|
|
||||||
### CONFIG ###
|
|
||||||
##############
|
|
||||||
### feel free to change those constants
|
|
||||||
# the dir where to store the cache (must be writable and readable by the current user)
|
|
||||||
# must be an absolute path
|
|
||||||
_KNIFE_AUTOCOMPLETE_CACHE_DIR="$HOME/.knife_autocomplete_cache"
|
|
||||||
# the maximum # of _seconds_ after which a cache will be considered stale
|
|
||||||
# (a cache is refreshed whenever it is used! this is only for caches that might not have been used for a long time)
|
|
||||||
# WARNING: keep that value > 100
|
|
||||||
_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE=86400
|
|
||||||
|
|
||||||
###############################################
|
|
||||||
### END OF CONFIG - DON'T CHANGE CODE BELOW ###
|
|
||||||
###############################################
|
|
||||||
|
|
||||||
### init
|
|
||||||
_KAC_CACHE_TMP_DIR="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/tmp"
|
|
||||||
# make sure the cache dir exists
|
|
||||||
mkdir -p "$_KAC_CACHE_TMP_DIR"
|
|
||||||
|
|
||||||
##############################
|
|
||||||
### Cache helper functions ###
|
|
||||||
##############################
|
|
||||||
|
|
||||||
# GNU or BSD stat?
|
|
||||||
stat -c %Y /dev/null > /dev/null 2>&1 && _KAC_STAT_COMMAND="stat -c %Y" || _KAC_STAT_COMMAND="stat -f %m"
|
|
||||||
|
|
||||||
# returns 0 iff the file whose path is given as 1st argument
|
|
||||||
# exists and has last been modified in the last $2 seconds
|
|
||||||
# returns 1 otherwise
|
|
||||||
_KAC_is_file_newer_than() {
|
|
||||||
[ -f "$1" ] || return 1
|
|
||||||
[ $(($(date +%s) - $($_KAC_STAT_COMMAND "$1"))) -gt "$2" ] && return 1 || return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# helper function for _KAC_get_and_regen_cache, see doc below
|
|
||||||
_KAC_regen_cache() {
|
|
||||||
local CACHE_NAME=$1
|
|
||||||
local CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME"
|
|
||||||
local TMP_FILE=$(mktemp "$_KAC_CACHE_TMP_DIR/$CACHE_NAME.XXXX")
|
|
||||||
shift 1
|
|
||||||
# discard the temp file if it's empty AND the previous command didn't exit successfully, but still mark the cache as updated
|
|
||||||
if ! "$@" > "$TMP_FILE" 2> /dev/null; then
|
|
||||||
[[ $(wc -l "$TMP_FILE") == 0 ]] && rm -f "$TMP_FILE" && touch "$CACHE_PATH" && return 1
|
|
||||||
else
|
|
||||||
mv -f "$TMP_FILE" "$CACHE_PATH"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# cached files can't have spaces in their names
|
|
||||||
_KAC_get_cache_name_from_command() {
|
|
||||||
echo "${@/ /_SPACE_}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# the reverse operation from the function above
|
|
||||||
_KAC_get_command_from_cache_name() {
|
|
||||||
echo "${@/_SPACE_/ }"
|
|
||||||
}
|
|
||||||
|
|
||||||
# given a command as argument, it fetches the cache for that command if it can find it
|
|
||||||
# otherwise it waits for the cache to be generated
|
|
||||||
# in either case, it regenerates the cache, and sets the _KAC_CACHE_PATH env variable
|
|
||||||
# for obvious reason, do NOT call that in a sub-shell (in particular, no piping)
|
|
||||||
_KAC_get_and_regen_cache() {
|
|
||||||
# the cache name can't have space in it
|
|
||||||
local CACHE_NAME=$(_KAC_get_cache_name_from_command "$@")
|
|
||||||
local REGEN_CMD="_KAC_regen_cache $CACHE_NAME $*"
|
|
||||||
_KAC_CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME"
|
|
||||||
# no need to wait for the regen if the file already exists
|
|
||||||
if [[ -f "$_KAC_CACHE_PATH" ]]; then
|
|
||||||
($REGEN_CMD &)
|
|
||||||
else
|
|
||||||
$REGEN_CMD
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# performs two things: first, deletes all obsolete temp files
|
|
||||||
# then refreshes stale caches that haven't been called in a long time
|
|
||||||
_KAC_clean_cache() {
|
|
||||||
local FILE CMD
|
|
||||||
# delete all obsolete temp files, could be lingering there for any kind of crash in the caching process
|
|
||||||
for FILE in "$_KAC_CACHE_TMP_DIR"/*; do
|
|
||||||
_KAC_is_file_newer_than "$FILE" "$_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE" || rm -f "$FILE"
|
|
||||||
done
|
|
||||||
# refresh really stale caches
|
|
||||||
find "$_KNIFE_AUTOCOMPLETE_CACHE_DIR" -maxdepth 1 -type f -not -name '.*' \
|
|
||||||
| while read -r FILE; do
|
|
||||||
_KAC_is_file_newer_than "$FILE" "$_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE" && continue
|
|
||||||
# first let's get the original command
|
|
||||||
CMD=$(_KAC_get_command_from_cache_name "$(basename "$FILE")")
|
|
||||||
# then regen the cache
|
|
||||||
_KAC_get_and_regen_cache "$CMD" > /dev/null
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# perform a cache cleaning when loading this file
|
|
||||||
# On big systems this could baloon up to a 30 second run or more, so not enabling by default.
|
|
||||||
[[ "${KNIFE_CACHE_CLEAN}" ]] && _KAC_clean_cache
|
|
||||||
|
|
||||||
#####################################
|
|
||||||
### End of cache helper functions ###
|
|
||||||
#####################################
|
|
||||||
|
|
||||||
# returns all the possible knife sub-commands
|
|
||||||
_KAC_knife_commands() {
|
|
||||||
knife --help | grep -E "^knife" | sed -E 's/ \(options\)//g'
|
|
||||||
}
|
|
||||||
|
|
||||||
# rebuilds the knife base command currently being completed, and assigns it to $_KAC_CURRENT_COMMAND
|
|
||||||
# additionnally, returns 1 iff the current base command is not complete, 0 otherwise
|
|
||||||
# also sets $_KAC_CURRENT_COMMAND_NB_WORDS if the base command is complete
|
|
||||||
_KAC_get_current_base_command() {
|
|
||||||
local PREVIOUS="knife"
|
|
||||||
local I=1
|
|
||||||
local CURRENT
|
|
||||||
while [ $I -le "$COMP_CWORD" ]; do
|
|
||||||
# command words are all lower-case
|
|
||||||
echo "${COMP_WORDS[$I]}" | grep -E "^[a-z]+$" > /dev/null || break
|
|
||||||
CURRENT="$PREVIOUS ${COMP_WORDS[$I]}"
|
|
||||||
grep -E "^$CURRENT" "$_KAC_CACHE_PATH" > /dev/null || break
|
|
||||||
PREVIOUS=$CURRENT
|
|
||||||
I=$((I + 1))
|
|
||||||
done
|
|
||||||
_KAC_CURRENT_COMMAND=$PREVIOUS
|
|
||||||
[ $I -le "$COMP_CWORD" ] && _KAC_CURRENT_COMMAND_NB_WORDS=$I
|
|
||||||
}
|
|
||||||
|
|
||||||
# searches the position of the currently completed argument in the current base command
|
|
||||||
# (i.e. handles "plural" arguments such as knife cookbook upload cookbook1 cookbook2 and so on...)
|
|
||||||
# assumes the current base command is complete
|
|
||||||
_KAC_get_current_arg_position() {
|
|
||||||
local CURRENT_ARG_POS=$((_KAC_CURRENT_COMMAND_NB_WORDS + 1))
|
|
||||||
local COMPLETE_COMMAND=$(grep -E "^$_KAC_CURRENT_COMMAND" "$_KAC_CACHE_PATH")
|
|
||||||
local CURRENT_ARG
|
|
||||||
while [ "$CURRENT_ARG_POS" -le "$COMP_CWORD" ]; do
|
|
||||||
CURRENT_ARG=$(echo "$COMPLETE_COMMAND" | cut -d ' ' -f "$CURRENT_ARG_POS")
|
|
||||||
# we break if the current arg is a "plural" arg
|
|
||||||
echo "$CURRENT_ARG" | grep -E "^\\[[^]]+(\\.\\.\\.\\]|$)" > /dev/null && break
|
|
||||||
CURRENT_ARG_POS=$((CURRENT_ARG_POS + 1))
|
|
||||||
done
|
|
||||||
echo "$CURRENT_ARG_POS"
|
|
||||||
}
|
|
||||||
|
|
||||||
# the actual auto-complete function
|
|
||||||
_knife() {
|
|
||||||
_KAC_get_and_regen_cache _KAC_knife_commands
|
|
||||||
local RAW_LIST ITEM REGEN_CMD ARG_POSITION
|
|
||||||
COMREPLY=()
|
|
||||||
# get correct command & arg pos
|
|
||||||
_KAC_get_current_base_command && ARG_POSITION=$(_KAC_get_current_arg_position) || ARG_POSITION=$((COMP_CWORD + 1))
|
|
||||||
RAW_LIST=$(grep -E "^$_KAC_CURRENT_COMMAND" "$_KAC_CACHE_PATH" | cut -d ' ' -f $ARG_POSITION | uniq)
|
|
||||||
|
|
||||||
# we need to process that raw list a bit, most notably for placeholders
|
|
||||||
# NOTE: I chose to explicitely fetch & cache _certain_ informations for the server (cookbooks & node names, etc)
|
|
||||||
# as opposed to a generic approach by trying to find a 'list' knife command corresponding to the
|
|
||||||
# current base command - that might limit my script in some situation, but that way I'm sure it caches only
|
|
||||||
# not-sensitive stuff (a generic approach could be pretty bad e.g. with the knife-rackspace plugin)
|
|
||||||
LIST=""
|
|
||||||
for ITEM in $RAW_LIST; do
|
|
||||||
# always relevant if only lower-case chars : continuation of the base command
|
|
||||||
echo "$ITEM" | grep -E "^[a-z]+$" > /dev/null && LIST="$LIST $ITEM" && continue
|
|
||||||
case "$ITEM" in
|
|
||||||
*COOKBOOK*)
|
|
||||||
# special case for cookbooks : from site or local
|
|
||||||
[[ ${COMP_WORDS[2]} == 'site' ]] && REGEN_CMD="knife cookbook site list" || REGEN_CMD="knife cookbook list"
|
|
||||||
_KAC_get_and_regen_cache "$REGEN_CMD"
|
|
||||||
LIST="$LIST $(cut -d ' ' -f 1 < "$_KAC_CACHE_PATH")"
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
*ITEM*)
|
|
||||||
# data bag item : another special case
|
|
||||||
local DATA_BAG_NAME=${COMP_WORDS[$((COMP_CWORD - 1))]}
|
|
||||||
REGEN_CMD="knife data bag show $DATA_BAG_NAME"
|
|
||||||
;;
|
|
||||||
*INDEX*)
|
|
||||||
# see doc @ http://docs.opscode.com/knife_search.html
|
|
||||||
LIST="$LIST client environment node role"
|
|
||||||
REGEN_CMD="knife data bag list"
|
|
||||||
;;
|
|
||||||
*BAG*) REGEN_CMD="knife data bag list" ;;
|
|
||||||
*CLIENT*) REGEN_CMD="knife client list" ;;
|
|
||||||
*NODE*) REGEN_CMD="knife node list" ;;
|
|
||||||
*ENVIRONMENT*) REGEN_CMD="knife environment list" ;;
|
|
||||||
*ROLE*) REGEN_CMD="knife role list" ;;
|
|
||||||
*USER*) REGEN_CMD="knife user list" ;;
|
|
||||||
# not a generic argument we support...
|
|
||||||
*) continue ;;
|
|
||||||
esac
|
|
||||||
_KAC_get_and_regen_cache "$REGEN_CMD"
|
|
||||||
LIST="$LIST $(cat "$_KAC_CACHE_PATH")"
|
|
||||||
done
|
|
||||||
# shellcheck disable=SC2207,SC2086
|
|
||||||
COMPREPLY=($(compgen -W "${LIST}" -- ${COMP_WORDS[COMP_CWORD]}))
|
|
||||||
}
|
|
||||||
|
|
||||||
complete -F _knife knife
|
|
|
@ -1,5 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
if _command_exists kontena; then
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "$(kontena whoami --bash-completion-path)"
|
|
||||||
fi
|
|
|
@ -1,7 +0,0 @@
|
||||||
# shellcheck shell=bash
|
|
||||||
cite "about-completion"
|
|
||||||
about-completion "kubectl (Kubernetes CLI) completion"
|
|
||||||
|
|
||||||
if _binary_exists kubectl; then
|
|
||||||
eval "$(kubectl completion bash)"
|
|
||||||
fi
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user