Compare commits
No commits in common. "master" and "v2.1.3" have entirely different histories.
|
|
@ -13,12 +13,11 @@ insert_final_newline = true
|
|||
trim_trailing_whitespace = false
|
||||
|
||||
[.git*]
|
||||
indent_size = tab
|
||||
indent_style = tab
|
||||
|
||||
[{**.*sh,test/run,**.bats}]
|
||||
indent_size = tab
|
||||
[{**.*sh,test/run}]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
shell_variant = bash
|
||||
binary_next_line = true # like -bn
|
||||
|
|
@ -29,8 +28,3 @@ end_of_line = lf
|
|||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[**.bats]
|
||||
indent_size = tab
|
||||
indent_style = tab
|
||||
shell_variant = bats
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a bug report to help us improve
|
||||
title: ''
|
||||
labels: bug:general
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--- Provide a general summary of the issue in the Title above -->
|
||||
|
||||
## Expected Behavior
|
||||
<!--- Tell us what should happen -->
|
||||
|
||||
## Current Behavior
|
||||
<!--- Tell us what happens instead of the expected behavior -->
|
||||
|
||||
## Possible Solution
|
||||
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
|
||||
|
||||
## Context
|
||||
<!--- How has this issue affected you? What are you trying to accomplish? -->
|
||||
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
|
||||
|
||||
## Steps to Reproduce
|
||||
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
|
||||
<!--- reproduce this bug. Include code to reproduce, if relevant -->
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
4.
|
||||
|
||||
## Your Environment
|
||||
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
||||
* Bash-it version used:
|
||||
* List of enabled plugins, themes and aliases (use ``bash-it show (plugins/themes/aliases)``):
|
||||
* ``bash-it doctor`` output:
|
||||
* Bash version:
|
||||
* Operating System and version:
|
||||
|
||||
## Your Bash Config File
|
||||
<!--- Please paste here your bash config file (.bashrc/.bash_profile) -->
|
||||
<!--- This will help us debug and locate the problem -->
|
||||
```bash
|
||||
# Your bash config file should be here
|
||||
```
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
name: 🐛 Bug report
|
||||
title: "[Bug]: "
|
||||
description: Create a bug report to help us improve
|
||||
labels: "bug:general"
|
||||
body:
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
description: Tell us what should happen.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Current behavior
|
||||
description: Tell us what happens instead of the expected behavior.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Possible solution
|
||||
description: Tell us how it could be fixed at your glance.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Context
|
||||
description: >
|
||||
How has this issue affected you? What are you trying to accomplish?
|
||||
Providing context helps us come up with a solution that is most useful in the real world.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: >
|
||||
Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant.
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: Bash-it version
|
||||
placeholder: "How to get: bash-it version"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: List of enabled plugins, themes and aliases
|
||||
placeholder: "How to get: bash-it show plugins|themes|aliases (it is not a pipe)"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: Bash version
|
||||
placeholder: "How to get: bash --version"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: Operating system and version
|
||||
placeholder: "How to get: neofetch (or another command)"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "bash-it doctor output"
|
||||
value: |
|
||||
```
|
||||
# How to get: bash-it doctor
|
||||
```
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Your ~/.bashrc
|
||||
value: |
|
||||
```bash
|
||||
# How to get: cat ~/.bashrc
|
||||
```
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Notes
|
||||
description: >
|
||||
Provide any extra details here.
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: Libera chat
|
||||
url: https://web.libera.chat/?channel=#bash-it
|
||||
about: You can ask and answer questions here
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: feature request
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--- Provide a general summary of the issue in the Title above -->
|
||||
|
||||
## Expected Behavior
|
||||
<!--- Tell us how your feature should work -->
|
||||
|
||||
## Current Behavior
|
||||
<!--- Explain the difference your feature will have from current behavior -->
|
||||
|
||||
## Possible Solution
|
||||
<!--- Not obligatory, but suggest ideas on how to implement the addition or change -->
|
||||
|
||||
## Context
|
||||
<!--- How has this issue affected you? What are you trying to accomplish? -->
|
||||
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
name: 💡 Feature request
|
||||
title: "[Feature]: "
|
||||
description: Suggest an idea for this project
|
||||
labels: "feature request"
|
||||
body:
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
description: Tell us how your feature should work.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Current behavior
|
||||
description: Explain the difference your feature will have from current behavior.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Possible solution
|
||||
description: Tell us how it could be fixed at your glance.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Context
|
||||
description: >
|
||||
How has this issue affected you? What are you trying to accomplish?
|
||||
Providing context helps us come up with a solution that is most useful in the real world.
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Notes
|
||||
description: >
|
||||
Provide any extra details here.
|
||||
|
|
@ -1,13 +1,17 @@
|
|||
name: CI
|
||||
|
||||
# Triggers the workflow on push or pull request events
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
bats-test:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-20.04, ubuntu-22.04, macos-12, macos-11]
|
||||
os: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04, macos-10.15]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
|
|
@ -16,9 +20,6 @@ jobs:
|
|||
- name: Install greadlink
|
||||
if: startsWith(runner.os, 'macOS')
|
||||
run: brew install coreutils
|
||||
- name: Install parallel
|
||||
if: startsWith(runner.os, 'macOS')
|
||||
run: brew install parallel
|
||||
- name: Test code
|
||||
run: test/run
|
||||
|
||||
|
|
@ -44,22 +45,15 @@ jobs:
|
|||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.17
|
||||
go-version: 1.14
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.8
|
||||
# - name: Update APT Package Lists
|
||||
# run: sudo apt-get update
|
||||
- name: Install shfmt
|
||||
run: GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt
|
||||
- name: Install shellcheck
|
||||
env:
|
||||
scversion: stable # Or latest, vxx, etc
|
||||
run: |
|
||||
wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv "shellcheck-${scversion}/shellcheck"
|
||||
sudo cp "shellcheck-${scversion}/shellcheck" /usr/bin/
|
||||
shellcheck --version
|
||||
run: brew install shellcheck
|
||||
- name: Install pre-commit
|
||||
run: python3 -m pip install -r test/lint-requirements.txt
|
||||
- name: Run lint
|
||||
|
|
|
|||
|
|
@ -17,8 +17,3 @@ bats
|
|||
enabled/*
|
||||
/enabled
|
||||
tmp/
|
||||
|
||||
# Do not save profiles
|
||||
profiles/*
|
||||
# apart from the default one
|
||||
!profiles/default.bash_it
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ repos:
|
|||
- id: mixed-line-ending
|
||||
- id: check-added-large-files
|
||||
- repo: https://github.com/jumanjihouse/pre-commit-hooks
|
||||
rev: 2.1.5
|
||||
rev: 2.1.4
|
||||
hooks:
|
||||
- id: git-check # Configure in .gitattributes
|
||||
- id: shellcheck
|
||||
|
|
@ -43,8 +43,3 @@ repos:
|
|||
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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
# We use colors and not assigned
|
||||
disable=SC2154
|
||||
# Hard to fix
|
||||
disable=SC2155
|
||||
# shellcheck is wrong on some
|
||||
disable=SC2034
|
||||
2
LICENSE
2
LICENSE
|
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2020-2021 Bash-it
|
||||
Copyright (c) 2020 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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'the silver searcher (ag) aliases'
|
||||
|
||||
## Summary for args to less:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'ansible abbreviations'
|
||||
|
||||
alias ans=ansible
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
#!/bin/bash
|
||||
#
|
||||
# -binaryanomaly
|
||||
|
||||
|
|
@ -6,8 +6,9 @@ cite 'about-alias'
|
|||
about-alias 'Apt and dpkg aliases for Ubuntu and Debian distros.'
|
||||
|
||||
# set apt aliases
|
||||
function _set_pkg_aliases() {
|
||||
if _command_exists apt; then
|
||||
function _set_pkg_aliases()
|
||||
{
|
||||
if [ -x $(which apt) ]; then
|
||||
alias apts='apt-cache search'
|
||||
alias aptshow='apt-cache show'
|
||||
alias aptinst='sudo apt-get install -V'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'Atom.io editor abbreviations'
|
||||
|
||||
alias a='atom'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'puppet bolt aliases'
|
||||
|
||||
# Aliases
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'ruby bundler'
|
||||
|
||||
# Bundler Commands
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'xclip shortcuts'
|
||||
|
||||
alias pbcopy="xclip -selection clipboard"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'common composer abbreviations'
|
||||
|
||||
# Aliases
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
# shellcheck shell=bash
|
||||
#!/bin/bash
|
||||
|
||||
cite 'about-alias'
|
||||
about-alias 'Curl aliases for convenience.'
|
||||
|
||||
# set apt aliases
|
||||
function _set_pkg_aliases() {
|
||||
if _command_exists curl; then
|
||||
function _set_pkg_aliases()
|
||||
{
|
||||
if [ -x $(which curl) ]; then
|
||||
# follow redirects
|
||||
alias cl='curl -L'
|
||||
# follow redirects, download as original name
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'dnf aliases for fedora 22+ distros'
|
||||
|
||||
alias dnfl="dnf list" # List packages
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'docker-compose abbreviations'
|
||||
|
||||
alias dco="docker-compose"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'docker abbreviations'
|
||||
|
||||
alias dk='docker'
|
||||
|
|
@ -11,7 +11,7 @@ alias dki='docker images'
|
|||
alias dkrmac='docker rm $(docker ps -a -q)' # Delete all Docker containers
|
||||
|
||||
case $OSTYPE in
|
||||
darwin* | *bsd* | *BSD*)
|
||||
darwin*|*bsd*|*BSD*)
|
||||
alias dkrmui='docker images -q -f dangling=true | xargs docker rmi' # Delete all untagged Docker images
|
||||
;;
|
||||
*)
|
||||
|
|
@ -19,8 +19,8 @@ case $OSTYPE in
|
|||
;;
|
||||
esac
|
||||
|
||||
if _bash-it-component-item-is-enabled plugin docker; then
|
||||
# Function aliases from docker plugin:
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'emacs editor'
|
||||
|
||||
case $OSTYPE in
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'fuck/please to retry last command with sudo'
|
||||
|
||||
# Play nicely with 'thefuck' plugin
|
||||
if ! _command_exists fuck; then
|
||||
if ! _command_exists fuck ; then
|
||||
alias fuck='sudo $(fc -ln -1)'
|
||||
fi
|
||||
alias please=fuck
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
# shellcheck shell=bash
|
||||
cite about-alias
|
||||
about-alias 'general aliases'
|
||||
|
||||
if command ls --color -d . &> /dev/null; then
|
||||
alias ls='ls --color=auto'
|
||||
# BSD `ls` doesn't need an argument (`-G`) when `$CLICOLOR` is set.
|
||||
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
|
||||
|
|
@ -12,34 +15,36 @@ alias la='ls -AF' # Compact view, show hidden
|
|||
alias ll='ls -al'
|
||||
alias l='ls -a'
|
||||
alias l1='ls -1'
|
||||
alias lf='ls -F'
|
||||
|
||||
alias _='sudo'
|
||||
alias _="sudo"
|
||||
|
||||
# Shortcuts to edit startup files
|
||||
alias vbrc='${VISUAL:-vim} ~/.bashrc'
|
||||
alias vbpf='${VISUAL:-vim} ~/.bash_profile'
|
||||
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 command grep --color=auto "a" "${BASH_IT?}"/*.md &> /dev/null; then
|
||||
if grep --color=auto "a" "${BASH_IT}/"*.md &> /dev/null
|
||||
then
|
||||
alias grep='grep --color=auto'
|
||||
fi
|
||||
|
||||
if _command_exists gshuf; then
|
||||
if which gshuf &> /dev/null
|
||||
then
|
||||
alias shuf=gshuf
|
||||
fi
|
||||
|
||||
alias c='clear'
|
||||
alias k='clear'
|
||||
alias cls='clear'
|
||||
|
||||
alias edit='${EDITOR:-${ALTERNATE_EDITOR:-nano}}'
|
||||
alias pager='${PAGER:=less}'
|
||||
alias edit="$EDITOR"
|
||||
alias pager="$PAGER"
|
||||
|
||||
alias q='exit'
|
||||
|
||||
alias irc='${IRC_CLIENT:=irc}'
|
||||
alias irc="${IRC_CLIENT:=irc}"
|
||||
|
||||
# Language aliases
|
||||
alias rb='ruby'
|
||||
|
|
@ -60,7 +65,8 @@ alias -- -='cd -' # Go back
|
|||
alias h='history'
|
||||
|
||||
# Tree
|
||||
if ! _command_exists tree; then
|
||||
if [ ! -x "$(which tree 2>/dev/null)" ]
|
||||
then
|
||||
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
|
||||
fi
|
||||
|
||||
|
|
@ -69,12 +75,16 @@ alias md='mkdir -p'
|
|||
alias rd='rmdir'
|
||||
|
||||
# Shorten extract
|
||||
alias xt='extract'
|
||||
alias xt="extract"
|
||||
|
||||
# sudo editors
|
||||
alias svim="sudo vim"
|
||||
alias snano="sudo nano"
|
||||
|
||||
# Display whatever file is regular file or folder
|
||||
function catt() {
|
||||
catt() {
|
||||
for i in "$@"; do
|
||||
if [[ -d "$i" ]]; then
|
||||
if [ -d "$i" ]; then
|
||||
ls "$i"
|
||||
else
|
||||
cat "$i"
|
||||
|
|
@ -88,5 +98,5 @@ function catt() {
|
|||
# aliases and enable just the ones for Bash-it explicitly:
|
||||
# bash-it disable alias general
|
||||
# bash-it enable alias bash-it
|
||||
# shellcheck source-path=SCRIPTDIR
|
||||
# shellcheck source=./bash-it.aliases.bash
|
||||
source "$BASH_IT/aliases/available/bash-it.aliases.bash"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'common git abbreviations'
|
||||
|
||||
alias g='git'
|
||||
|
|
@ -8,18 +9,13 @@ alias get='git'
|
|||
alias ga='git add'
|
||||
alias gall='git add -A'
|
||||
alias gap='git add -p'
|
||||
alias gav='git add -v'
|
||||
|
||||
# branch
|
||||
alias gb='git branch'
|
||||
alias gba='git branch --all'
|
||||
alias gbd='git branch -d'
|
||||
alias gbD='git branch -D'
|
||||
alias gbl='git branch --list'
|
||||
alias gbla='git branch --list --all'
|
||||
alias gblr='git branch --list --remotes'
|
||||
alias gbm='git branch --move'
|
||||
alias gbr='git branch --remotes'
|
||||
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'
|
||||
|
||||
|
|
@ -41,8 +37,8 @@ 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 gcom='git checkout master'
|
||||
alias gcpd='git checkout master; git pull; git branch -D'
|
||||
alias gct='git checkout --track'
|
||||
|
||||
# clone
|
||||
|
|
@ -68,14 +64,13 @@ 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 gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master'
|
||||
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'
|
||||
|
|
@ -109,7 +104,7 @@ 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 gpom='git push origin master'
|
||||
alias gpu='git push --set-upstream'
|
||||
alias gpunch='git push --force-with-lease'
|
||||
alias gpuo='git push --set-upstream origin'
|
||||
|
|
@ -117,7 +112,7 @@ 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 glum='git pull upstream master'
|
||||
alias gpl='git pull'
|
||||
alias gpp='git pull && git push'
|
||||
alias gpr='git pull --rebase'
|
||||
|
|
@ -133,10 +128,9 @@ 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 grma='GIT_SEQUENCE_EDITOR=: git rebase $(get_default_branch) -i --autosquash'
|
||||
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
|
||||
alias grm='git rebase master'
|
||||
alias grmi='git rebase master -i'
|
||||
alias gprom='git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master' # Rebase with latest remote master
|
||||
|
||||
# reset
|
||||
alias gus='git reset HEAD'
|
||||
|
|
@ -180,7 +174,7 @@ alias gsu='git submodule update --init --recursive'
|
|||
# these aliases requires git v2.23+
|
||||
alias gsw='git switch'
|
||||
alias gswc='git switch --create'
|
||||
alias gswm='git switch $(get_default_branch)'
|
||||
alias gswm='git switch master'
|
||||
alias gswt='git switch --track'
|
||||
|
||||
# tag
|
||||
|
|
@ -202,11 +196,3 @@ esac
|
|||
function gdv() {
|
||||
git diff --ignore-all-space "$@" | vim -R -
|
||||
}
|
||||
|
||||
function get_default_branch() {
|
||||
if git branch | grep -q '^. main\s*$'; then
|
||||
echo main
|
||||
else
|
||||
echo master
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'common git-svn abbreviations'
|
||||
|
||||
# Aliases
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'heroku task abbreviations'
|
||||
|
||||
# heroku
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'mercurial abbreviations'
|
||||
|
||||
alias hs='hg status'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
# shellcheck shell=bash
|
||||
about-alias 'Some aliases for Homebrew Cask'
|
||||
# Some aliases for Homebrew Cask
|
||||
|
||||
cite 'about-alias'
|
||||
about-alias 'homebrew-cask abbreviations'
|
||||
|
||||
alias bcin='brew cask install'
|
||||
alias bcrm='brew cask uninstall'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
# shellcheck shell=bash
|
||||
about-alias 'Some aliases for Homebrew'
|
||||
# Some aliases for Homebrew
|
||||
|
||||
cite 'about-alias'
|
||||
about-alias 'homebrew abbreviations'
|
||||
|
||||
alias bup='brew update && brew upgrade'
|
||||
alias bout='brew outdated'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'homesick aliases'
|
||||
|
||||
# Aliases
|
||||
|
|
@ -19,5 +19,6 @@ 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,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'jitsu task abbreviations'
|
||||
|
||||
# jitsu
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
# shellcheck shell=bash
|
||||
#!/bin/bash
|
||||
#
|
||||
# -binaryanomaly
|
||||
|
||||
cite 'about-alias'
|
||||
about-alias 'kubectl aliases'
|
||||
|
||||
if _command_exists kubectl; then
|
||||
function _set_pkg_aliases()
|
||||
{
|
||||
if _command_exists kubectl; then
|
||||
alias kc='kubectl'
|
||||
alias kcgp='kubectl get pods'
|
||||
alias kcgd='kubectl get deployments'
|
||||
|
|
@ -13,4 +19,7 @@ if _command_exists kubectl; then
|
|||
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
|
||||
fi
|
||||
}
|
||||
|
||||
_set_pkg_aliases
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'laravel artisan abbreviations'
|
||||
|
||||
# A list of useful laravel aliases
|
||||
|
||||
alias laravel='${HOME?}/.composer/vendor/bin/laravel'
|
||||
alias laravel="${HOME}/.composer/vendor/bin/laravel"
|
||||
# asset
|
||||
alias a:apub='php artisan asset:publish'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'maven abbreviations'
|
||||
|
||||
alias mci='mvn clean install'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
# shellcheck shell=bash
|
||||
#!/bin/bash
|
||||
|
||||
cite 'about-alias'
|
||||
about-alias 'MSYS2 aliases'
|
||||
|
||||
LS_COMMON="-hG"
|
||||
|
|
@ -7,8 +9,7 @@ LS_COMMON="$LS_COMMON -I NTUSER.DAT\* -I ntuser.dat\*"
|
|||
|
||||
# alias
|
||||
# setup the main ls alias if we've established common args
|
||||
alias ls='command ls ${LS_COMMON:-}'
|
||||
test -n "$LS_COMMON" && alias ls="command ls $LS_COMMON"
|
||||
alias ll="ls -l"
|
||||
alias la="ls -a"
|
||||
alias lal="ll -a"
|
||||
alias lf="ls -F"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'the Node.js environment aliases'
|
||||
|
||||
# alias to setup nodejs development environment
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'common npm abbreviations'
|
||||
|
||||
# Aliases
|
||||
|
|
|
|||
|
|
@ -1,27 +1,26 @@
|
|||
# shellcheck shell=bash
|
||||
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 brave='open -a "Brave Browser"'
|
||||
alias dashcode='open -a dashcode'
|
||||
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"'
|
||||
alias subl='open -a Sublime\ Text'
|
||||
|
||||
if [[ -s /usr/bin/firefox ]]; then
|
||||
if [ -s /usr/bin/firefox ] ; then
|
||||
unalias firefox
|
||||
fi
|
||||
|
||||
|
|
@ -38,20 +37,19 @@ alias whotunes='lsof -r 2 -n -P -F n -c iTunes -a -i TCP@`hostname`:3689'
|
|||
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'
|
||||
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
|
||||
# shellcheck disable=SC2142 # The quoting confuses `shellcheck`...
|
||||
alias copyLastCmd="fc -ln -1 | awk '{\$1=\$1}1' ORS='' | pbcopy"
|
||||
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"'
|
||||
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."'
|
||||
alias lmk="say 'Process complete.'"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'phoenix abbreviations'
|
||||
|
||||
# Phoenix Commands
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'puppet aliases'
|
||||
|
||||
# Aliases
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'pyrocms abbreviations'
|
||||
|
||||
###
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'rails abbreviations'
|
||||
|
||||
# Rails Commands
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'common svn abbreviations'
|
||||
|
||||
# Aliases
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# shellcheck shell=bash
|
||||
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
|
||||
# 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'
|
||||
|
|
@ -14,7 +14,7 @@ case $OSTYPE in
|
|||
alias sceu='systemctl --user stop'
|
||||
alias scs='systemctl start'
|
||||
alias scsu='systemctl --user start'
|
||||
# Keeping previous aliases for a non-breaking change.
|
||||
# Keeping previous aliases for a non-breaking change.
|
||||
alias scue='sceu'
|
||||
alias scus='scsu'
|
||||
alias scur='scdru'
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
# shellcheck shell=bash
|
||||
about-alias 'Aliases for Terraform and Terragrunt'
|
||||
# Aliases for Terraform and Terragrunt
|
||||
|
||||
cite 'about-alias'
|
||||
about-alias 'Terraform abbreviations'
|
||||
|
||||
alias tf='terraform'
|
||||
alias tfi='tf init'
|
||||
alias tfv='terraform validate'
|
||||
alias tfp='terraform plan'
|
||||
alias tfa='terraform apply'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
# shellcheck shell=bash
|
||||
about-alias 'Aliases for Terraform and Terragrunt'
|
||||
# Aliases for Terraform and Terragrunt
|
||||
|
||||
cite 'about-alias'
|
||||
about-alias 'Terragrunt abbreviations'
|
||||
|
||||
alias tg='terragrunt'
|
||||
alias tgv='terragrunt validate'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'textmate abbreviations'
|
||||
|
||||
case $OSTYPE in
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'Tmux terminal multiplexer'
|
||||
|
||||
alias txl='tmux ls'
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# shellcheck shell=bash
|
||||
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'
|
||||
alias tls="$TODO ls"
|
||||
alias ta="$TODO a"
|
||||
alias trm="$TODO rm"
|
||||
alias tdo="$TODO do"
|
||||
alias tpri="$TODO pri"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'uuid-alias'
|
||||
about-alias 'uuidgen aliases'
|
||||
|
||||
if _command_exists uuid; then # Linux
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'vagrant aliases'
|
||||
|
||||
# Aliases
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'vault aliases'
|
||||
|
||||
# Aliases
|
||||
|
|
|
|||
|
|
@ -1,14 +1,25 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'vim abbreviations'
|
||||
|
||||
_command_exists vim || return
|
||||
VIM=$(command -v vim)
|
||||
GVIM=$(command -v gvim)
|
||||
MVIM=$(command -v mvim)
|
||||
|
||||
alias v='vim'
|
||||
# open the vim help in fullscreen incorporated from
|
||||
# https://stackoverflow.com/a/4687513
|
||||
alias vimh='vim -c ":h | only"'
|
||||
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
|
||||
_command_exists mvim && function mvimt { command mvim --remote-tab-silent "$@" || command mvim "$@"; }
|
||||
_command_exists gvim && function gvimt { command gvim --remote-tab-silent "$@" || command gvim "$@"; }
|
||||
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,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
cite 'about-alias'
|
||||
about-alias 'yarn package manager aliases'
|
||||
|
||||
# Aliases
|
||||
|
|
|
|||
161
bash_it.sh
161
bash_it.sh
|
|
@ -1,110 +1,159 @@
|
|||
#!/usr/bin/env bash
|
||||
# shellcheck source-path=SCRIPTDIR/lib source-path=SCRIPTDIR/scripts
|
||||
# shellcheck disable=SC2034
|
||||
#
|
||||
# Initialize Bash It
|
||||
BASH_IT_LOG_PREFIX="core: main: "
|
||||
: "${BASH_IT:=${BASH_SOURCE%/*}}"
|
||||
: "${BASH_IT_CUSTOM:=${BASH_IT}/custom}"
|
||||
: "${CUSTOM_THEME_DIR:="${BASH_IT_CUSTOM}/themes"}"
|
||||
: "${BASH_IT_BASHRC:=${BASH_SOURCE[${#BASH_SOURCE[@]} - 1]}}"
|
||||
|
||||
# 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 source-path=SCRIPTDIR/vendor/github.com/erichs/composure
|
||||
source "${BASH_IT}/vendor/github.com/erichs/composure/composure.sh"
|
||||
# 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
|
||||
|
||||
# Declare our end-of-main finishing hook, but don't use `declare`/`typeset`
|
||||
_bash_it_library_finalize_hook=()
|
||||
|
||||
# We need to load logging module early in order to be able to log
|
||||
source "${BASH_IT}/lib/log.bash"
|
||||
|
||||
# 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_main_file_lib in "${BASH_IT}/lib"/*.bash; do
|
||||
[[ "$_bash_it_main_file_lib" == "$APPEARANCE_LIB" ]] && continue
|
||||
_bash-it-log-prefix-by-path "${_bash_it_main_file_lib}"
|
||||
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_main_file_lib"
|
||||
BASH_IT_LOG_PREFIX="core: main: "
|
||||
source "$_bash_it_config_file"
|
||||
fi
|
||||
done
|
||||
|
||||
# Load the global "enabled" directory, then enabled aliases, completion, plugins
|
||||
# "_bash_it_main_file_type" param is empty so that files get sourced in glob order
|
||||
for _bash_it_main_file_type in "" "aliases" "plugins" "completion"; do
|
||||
BASH_IT_LOG_PREFIX="core: reloader: "
|
||||
# shellcheck disable=SC2140
|
||||
source "${BASH_IT}/scripts/reloader.bash" ${_bash_it_main_file_type:+"skip" "$_bash_it_main_file_type"}
|
||||
BASH_IT_LOG_PREFIX="core: main: "
|
||||
# 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
|
||||
# shellcheck source-path=SCRIPTDIR/themes
|
||||
if [[ -n "${BASH_IT_THEME:-}" ]]; then
|
||||
_log_debug "Loading theme '${BASH_IT_THEME}'."
|
||||
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=SCRIPTDIR/lib/appearance.bash
|
||||
# shellcheck source=./lib/appearance.bash
|
||||
source "$APPEARANCE_LIB"
|
||||
BASH_IT_LOG_PREFIX="core: main: "
|
||||
fi
|
||||
|
||||
BASH_IT_LOG_PREFIX="core: main: "
|
||||
_log_debug "Loading custom aliases, completion, plugins..."
|
||||
for _bash_it_main_file_type in "aliases" "completion" "plugins"; do
|
||||
_bash_it_main_file_custom="${BASH_IT}/${_bash_it_main_file_type}/custom.${_bash_it_main_file_type}.bash"
|
||||
if [[ -s "${_bash_it_main_file_custom}" ]]; then
|
||||
_bash-it-log-prefix-by-path "${_bash_it_main_file_custom}"
|
||||
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_main_file_custom}"
|
||||
source "${BASH_IT}/${file_type}/custom.${file_type}.bash"
|
||||
fi
|
||||
BASH_IT_LOG_PREFIX="core: main: "
|
||||
done
|
||||
|
||||
# Custom
|
||||
BASH_IT_LOG_PREFIX="core: main: "
|
||||
_log_debug "Loading general custom files..."
|
||||
for _bash_it_main_file_custom in "${BASH_IT_CUSTOM}"/*.bash "${BASH_IT_CUSTOM}"/*/*.bash; do
|
||||
if [[ -s "${_bash_it_main_file_custom}" ]]; then
|
||||
_bash-it-log-prefix-by-path "${_bash_it_main_file_custom}"
|
||||
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_main_file_custom"
|
||||
source "$_bash_it_config_file"
|
||||
fi
|
||||
BASH_IT_LOG_PREFIX="core: main: "
|
||||
done
|
||||
|
||||
if [[ -n "${PROMPT:-}" ]]; then
|
||||
PS1="${PROMPT}"
|
||||
unset _bash_it_config_file
|
||||
if [[ $PROMPT ]]; then
|
||||
export PS1="\[""$PROMPT""\]"
|
||||
fi
|
||||
|
||||
# Adding Support for other OSes
|
||||
if _command_exists gloobus-preview; then
|
||||
PREVIEW="less"
|
||||
|
||||
if [ -s /usr/bin/gloobus-preview ]; then
|
||||
PREVIEW="gloobus-preview"
|
||||
elif [[ -d /Applications/Preview.app ]]; then
|
||||
elif [ -s /Applications/Preview.app ]; then
|
||||
# shellcheck disable=SC2034
|
||||
PREVIEW="/Applications/Preview.app"
|
||||
else
|
||||
PREVIEW="less"
|
||||
fi
|
||||
|
||||
# Load all the Jekyll stuff
|
||||
|
||||
if [ -e "$HOME/.jekyllconfig" ]; then
|
||||
# shellcheck disable=SC1090
|
||||
. "$HOME/.jekyllconfig"
|
||||
fi
|
||||
|
||||
# BASH_IT_RELOAD_LEGACY is set.
|
||||
if [[ -n "${BASH_IT_RELOAD_LEGACY:-}" ]] && ! _command_exists reload; then
|
||||
# shellcheck disable=SC2139
|
||||
alias reload="builtin source '${BASH_IT_BASHRC?}'"
|
||||
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
|
||||
|
||||
for _bash_it_library_finalize_f in "${_bash_it_library_finalize_hook[@]:-}"; do
|
||||
eval "${_bash_it_library_finalize_f?}" # Use `eval` to achieve the same behavior as `$PROMPT_COMMAND`.
|
||||
done
|
||||
unset "${!_bash_it_library_finalize_@}" "${!_bash_it_main_file_@}"
|
||||
# Disable trap DEBUG on subshells - https://github.com/Bash-it/bash-it/pull/1040
|
||||
set +T
|
||||
|
|
|
|||
162
clean_files.txt
162
clean_files.txt
|
|
@ -1,7 +1,7 @@
|
|||
#######################################################################
|
||||
# Allow-list of files to be lint-checked by CI
|
||||
#
|
||||
# Directory Support
|
||||
# Directory Suport
|
||||
# Directory references are allowed within the file, ie:
|
||||
#
|
||||
# themes/powerline
|
||||
|
|
@ -16,54 +16,75 @@
|
|||
|
||||
# root directories
|
||||
#
|
||||
aliases/
|
||||
docs/
|
||||
hooks/
|
||||
scripts/
|
||||
docs
|
||||
hooks
|
||||
|
||||
# root files
|
||||
#
|
||||
.gitattributes
|
||||
bash_it.sh
|
||||
clean_files.txt
|
||||
install.sh
|
||||
lint_clean_files.sh
|
||||
install.sh
|
||||
bash_it.sh
|
||||
|
||||
# themes
|
||||
#
|
||||
themes/agnoster
|
||||
themes/90210
|
||||
themes/powerline
|
||||
themes/barbuk
|
||||
themes/atomic
|
||||
themes/axin
|
||||
themes/base.theme.bash
|
||||
themes/bakke
|
||||
themes/binaryanomaly
|
||||
themes/bira
|
||||
themes/bobby
|
||||
themes/bobby-python
|
||||
themes/brainy
|
||||
themes/brunton
|
||||
themes/command_duration.theme.bash
|
||||
themes/easy
|
||||
themes/modern
|
||||
themes/purity
|
||||
|
||||
# plugins
|
||||
#
|
||||
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.plugin.bash
|
||||
plugins/available/history-search.plugin.bash
|
||||
plugins/available/history-substring-search.plugin.bash
|
||||
plugins/available/xterm.plugin.bash
|
||||
|
||||
# completions
|
||||
#
|
||||
completion/available/apm.completion.bash
|
||||
completion/available/awless.completion.bash
|
||||
completion/available/awscli.completion.bash
|
||||
completion/available/bash-it.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/dart.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/dotnet.completion.bash
|
||||
completion/available/flutter.completion.bash
|
||||
completion/available/docker-machine.completion.bash
|
||||
completion/available/gcloud.completion.bash
|
||||
completion/available/gem.completion.bash
|
||||
completion/available/git.completion.bash
|
||||
completion/available/github-cli.completion.bash
|
||||
completion/available/go.completion.bash
|
||||
completion/available/github-cli.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/laravel.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/ngrok.completion.bash
|
||||
completion/available/npm.completion.bash
|
||||
completion/available/packer.completion.bash
|
||||
completion/available/pip.completion.bash
|
||||
|
|
@ -71,106 +92,19 @@ 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/system.completion.bash
|
||||
completion/available/vault.completion.bash
|
||||
completion/available/sdkman.completion.bash
|
||||
completion/available/vuejs.completion.bash
|
||||
completion/available/wpscan.completion.bash
|
||||
completion/available/yarn.completion.bash
|
||||
|
||||
# libraries
|
||||
lib/appearance.bash
|
||||
lib/colors.bash
|
||||
lib/command_duration.bash
|
||||
lib/helpers.bash
|
||||
lib/history.bash
|
||||
lib/log.bash
|
||||
lib/preexec.bash
|
||||
lib/preview.bash
|
||||
lib/search.bash
|
||||
lib/utilities.bash
|
||||
|
||||
# plugins
|
||||
# aliases
|
||||
#
|
||||
plugins/available/alias-completion.plugin.bash
|
||||
plugins/available/autojump.plugin.bash
|
||||
plugins/available/base.plugin.bash
|
||||
plugins/available/basher.plugin.bash
|
||||
plugins/available/battery.plugin.bash
|
||||
plugins/available/blesh.plugin.bash
|
||||
plugins/available/cmd-returned-notify.plugin.bash
|
||||
plugins/available/colors.plugin.bash
|
||||
plugins/available/direnv.plugin.bash
|
||||
plugins/available/dirs.plugin.bash
|
||||
plugins/available/docker-machine.plugin.bash
|
||||
plugins/available/gif.plugin.bash
|
||||
plugins/available/git-subrepo.plugin.bash
|
||||
plugins/available/git.plugin.bash
|
||||
plugins/available/go.plugin.bash
|
||||
plugins/available/goenv.plugin.bash
|
||||
plugins/available/history-eternal.plugin.bash
|
||||
plugins/available/history-search.plugin.bash
|
||||
plugins/available/history-substring-search.plugin.bash
|
||||
plugins/available/history.plugin.bash
|
||||
plugins/available/hub.plugin.bash
|
||||
plugins/available/java.plugin.bash
|
||||
plugins/available/jekyll.plugin.bash
|
||||
plugins/available/jump.plugin.bash
|
||||
plugins/available/latex.plugin.bash
|
||||
plugins/available/less-pretty-cat.plugin.bash
|
||||
plugins/available/man.plugin.bash
|
||||
plugins/available/nginx.plugin.bash
|
||||
plugins/available/node.plugin.bash
|
||||
plugins/available/nodenv.plugin.bash
|
||||
plugins/available/osx-timemachine.plugin.bash
|
||||
plugins/available/osx.plugin.bash
|
||||
plugins/available/percol.plugin.bash
|
||||
plugins/available/plenv.plugin.bash
|
||||
plugins/available/projects.plugin.bash
|
||||
plugins/available/proxy.plugin.bash
|
||||
plugins/available/pyenv.plugin.bash
|
||||
plugins/available/python.plugin.bash
|
||||
plugins/available/rbenv.plugin.bash
|
||||
plugins/available/ruby.plugin.bash
|
||||
plugins/available/textmate.plugin.bash
|
||||
plugins/available/todo.plugin.bash
|
||||
plugins/available/xterm.plugin.bash
|
||||
plugins/available/zoxide.plugin.bash
|
||||
aliases/available/dnf.aliases.bash
|
||||
aliases/available/vim.aliases.bash
|
||||
aliases/available/git.aliases.bash
|
||||
|
||||
# tests
|
||||
#
|
||||
test/completion/aliases.completion.bats
|
||||
test/run
|
||||
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/easy
|
||||
themes/essential
|
||||
themes/githelpers.theme.bash
|
||||
themes/modern
|
||||
themes/norbu
|
||||
themes/oh-my-posh
|
||||
themes/p4helpers.theme.bash
|
||||
themes/pete
|
||||
themes/powerline
|
||||
themes/pure
|
||||
themes/purity
|
||||
|
||||
# vendor init files
|
||||
#
|
||||
vendor/.gitattributes
|
||||
vendor/init.d
|
||||
|
|
|
|||
|
|
@ -1,112 +0,0 @@
|
|||
# shellcheck shell=bash
|
||||
about-plugin 'Automatic completion of aliases'
|
||||
# Load after all aliases and completions to understand what needs to be completed
|
||||
# BASH_IT_LOAD_PRIORITY: 800
|
||||
|
||||
# References:
|
||||
# http://superuser.com/a/437508/119764
|
||||
# http://stackoverflow.com/a/1793178/1228454
|
||||
|
||||
# Automatically add completion for all aliases to commands having completion functions
|
||||
function _bash-it-component-completion-callback-on-init-aliases() {
|
||||
local namespace="alias_completion"
|
||||
local tmp_file completion_loader alias_name line completions chars
|
||||
local alias_arg_words new_completion compl_func compl_wrapper alias_defn
|
||||
|
||||
# create array of function completion triggers, keeping multi-word triggers together
|
||||
IFS=$'\n' read -d '' -ra completions < <(complete -p)
|
||||
((${#completions[@]} == 0)) && return 0
|
||||
|
||||
completions=("${completions[@]##complete -* * -}") # strip all but last option plus trigger(s)
|
||||
completions=("${completions[@]#complete -}") # strip anything missed
|
||||
completions=("${completions[@]#? * }") # strip last option and arg, leaving only trigger(s)
|
||||
completions=("${completions[@]#? }") # strip anything missed
|
||||
#TODO: this will fail on some completions...
|
||||
|
||||
# create temporary file for wrapper functions and completions
|
||||
tmp_file="$(mktemp -t "${namespace}-${RANDOM}XXXXXX")" || return 1
|
||||
|
||||
IFS=$'\n' read -r completion_loader < <(complete -p -D 2> /dev/null)
|
||||
if [[ "${completion_loader#complete }" =~ '-F'[[:space:]]([[:alnum:]_]+)[[:space:]] ]]; then
|
||||
completion_loader="${BASH_REMATCH[1]}"
|
||||
else
|
||||
completion_loader=""
|
||||
fi
|
||||
|
||||
# read in "<alias> '<aliased command>' '<command args>'" lines from defined aliases
|
||||
# some aliases do have backslashes that needs to be interpreted
|
||||
# shellcheck disable=SC2162
|
||||
while read line; do
|
||||
line="${line#alias -- }"
|
||||
line="${line#alias }"
|
||||
alias_name="${line%%=*}"
|
||||
alias_defn="${line#*=\'}" # alias definition
|
||||
alias_defn="${alias_defn%\'}"
|
||||
alias_cmd="${alias_defn%%[[:space:]]*}" # first word of alias
|
||||
if [[ ${alias_defn} == ${alias_cmd} ]]; then
|
||||
alias_args=''
|
||||
else
|
||||
alias_args="${alias_defn#*[[:space:]]}" # everything after first word
|
||||
fi
|
||||
|
||||
# skip aliases to pipes, boolean control structures and other command lists
|
||||
chars=$'|&;()<>\n'
|
||||
if [[ "${alias_defn}" =~ [$chars] ]]; then
|
||||
continue
|
||||
fi
|
||||
# avoid expanding wildcards
|
||||
read -ra alias_arg_words <<< "$alias_args"
|
||||
|
||||
# skip alias if there is no completion function triggered by the aliased command
|
||||
if ! _bash-it-array-contains-element "$alias_cmd" "${completions[@]}"; then
|
||||
if [[ -n "$completion_loader" ]]; then
|
||||
# force loading of completions for the aliased command
|
||||
"${completion_loader:?}" "${alias_cmd}"
|
||||
# 124 means completion loader was successful
|
||||
[[ $? -eq 124 ]] || continue
|
||||
completions+=("$alias_cmd")
|
||||
else
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
new_completion="$(complete -p "$alias_cmd" 2> /dev/null)"
|
||||
|
||||
# create a wrapper inserting the alias arguments if any
|
||||
if [[ -n $alias_args ]]; then
|
||||
compl_func="${new_completion/#* -F /}"
|
||||
compl_func="${compl_func%% *}"
|
||||
# avoid recursive call loops by ignoring our own functions
|
||||
if [[ "${compl_func#_"$namespace"::}" == "$compl_func" ]]; then
|
||||
compl_wrapper="_${namespace}::${alias_name}"
|
||||
echo "function $compl_wrapper {
|
||||
local compl_word=\${2?}
|
||||
local prec_word=\${3?}
|
||||
# check if prec_word is the alias itself. if so, replace it
|
||||
# with the last word in the unaliased form, i.e.,
|
||||
# alias_cmd + ' ' + alias_args.
|
||||
if [[ \$COMP_LINE == \"\$prec_word \$compl_word\" ]]; then
|
||||
prec_word='$alias_cmd $alias_args'
|
||||
prec_word=\${prec_word#* }
|
||||
fi
|
||||
(( COMP_CWORD += ${#alias_arg_words[@]} ))
|
||||
COMP_WORDS=(\"$alias_cmd\" \"${alias_arg_words[@]}\" \"\${COMP_WORDS[@]:1}\")
|
||||
(( COMP_POINT -= \${#COMP_LINE} ))
|
||||
COMP_LINE=\${COMP_LINE/$alias_name/$alias_cmd $alias_args}
|
||||
(( COMP_POINT += \${#COMP_LINE} ))
|
||||
\"$compl_func\" \"$alias_cmd\" \"\$compl_word\" \"\$prec_word\"
|
||||
}" >> "$tmp_file"
|
||||
new_completion="${new_completion/ -F $compl_func / -F $compl_wrapper }"
|
||||
fi
|
||||
fi
|
||||
|
||||
# replace completion trigger by alias
|
||||
if [[ -n $new_completion ]]; then
|
||||
new_completion="${new_completion% *} $alias_name"
|
||||
echo "$new_completion" >> "$tmp_file"
|
||||
fi
|
||||
done < <(alias -p)
|
||||
# shellcheck source=/dev/null
|
||||
source "$tmp_file" && command rm -f "$tmp_file"
|
||||
}
|
||||
|
||||
_bash-it-component-completion-callback-on-init-aliases
|
||||
|
|
@ -1,5 +1 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
if _command_exists aws_completer; then
|
||||
complete -C "$(command -v aws_completer)" aws
|
||||
fi
|
||||
[[ -x "$(which aws_completer)" ]] && complete -C "$(which aws_completer)" aws
|
||||
|
|
|
|||
|
|
@ -1,95 +1,140 @@
|
|||
# shellcheck shell=bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function _compreply_candidates() {
|
||||
local IFS=$'\n'
|
||||
|
||||
read -d '' -ra COMPREPLY < <(compgen -W "${candidates[*]}" -- "${cur}")
|
||||
_bash-it-comp-enable-disable()
|
||||
{
|
||||
local enable_disable_args="alias completion plugin"
|
||||
COMPREPLY=( $(compgen -W "${enable_disable_args}" -- ${cur}) )
|
||||
}
|
||||
|
||||
function _bash-it() {
|
||||
local cur prev verb file_type candidates suffix
|
||||
_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]}"
|
||||
verb="${COMP_WORDS[1]}"
|
||||
file_type="${COMP_WORDS[2]:-}"
|
||||
candidates=('disable' 'enable' 'help' 'migrate' 'reload' 'restart' 'preview' 'profile' 'doctor' 'search' 'show' 'update' 'version')
|
||||
case "${verb}" in
|
||||
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)
|
||||
candidates=('aliases' 'completions' 'plugins')
|
||||
_compreply_candidates
|
||||
local show_args="aliases completions plugins"
|
||||
COMPREPLY=( $(compgen -W "${show_args}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
help)
|
||||
if [[ "${prev}" == "aliases" ]]; then
|
||||
candidates=('all' "$(_bash-it-component-list "${file_type}")")
|
||||
_compreply_candidates
|
||||
if [ x"${prev}" == x"aliases" ]; then
|
||||
_bash-it-comp-list-available aliases
|
||||
return 0
|
||||
else
|
||||
candidates=('aliases' 'completions' 'migrate' 'plugins' 'update')
|
||||
_compreply_candidates
|
||||
local help_args="aliases completions migrate plugins update"
|
||||
COMPREPLY=( $(compgen -W "${help_args}" -- ${cur}) )
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
profile)
|
||||
case "${file_type}" in
|
||||
load | rm)
|
||||
if [[ "${file_type}" == "$prev" ]]; then
|
||||
candidates=("${BASH_IT}/profiles"/*.bash_it)
|
||||
candidates=("${candidates[@]##*/}")
|
||||
candidates=("${candidates[@]%%.bash_it}")
|
||||
|
||||
_compreply_candidates
|
||||
fi
|
||||
;;
|
||||
save | list) ;;
|
||||
*)
|
||||
candidates=('load' 'save' 'list' 'rm')
|
||||
_compreply_candidates
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
doctor)
|
||||
candidates=('errors' 'warnings' 'all')
|
||||
_compreply_candidates
|
||||
local doctor_args="errors warnings all"
|
||||
COMPREPLY=( $(compgen -W "${doctor_args}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
update)
|
||||
if [[ "${cur}" == -* ]]; then
|
||||
candidates=('-s' '--silent')
|
||||
if [[ ${cur} == -* ]];then
|
||||
local update_args="-s --silent"
|
||||
else
|
||||
candidates=('stable' 'dev')
|
||||
local update_args="stable dev"
|
||||
fi
|
||||
_compreply_candidates
|
||||
COMPREPLY=( $(compgen -W "${update_args}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
migrate | reload | restart | search | version) ;;
|
||||
preview)
|
||||
_bash-it-preview # completes itself
|
||||
migrate | reload | search | version)
|
||||
return 0
|
||||
;;
|
||||
enable | disable)
|
||||
if [[ "${verb}" == "enable" ]]; then
|
||||
suffix="disabled"
|
||||
if [ x"${chose_opt}" == x"enable" ];then
|
||||
suffix="available-not-enabled"
|
||||
else
|
||||
suffix="enabled"
|
||||
fi
|
||||
case "${file_type}" in
|
||||
alias | completion | plugin)
|
||||
candidates=('all' "$("_bash-it-component-list-${suffix}" "${file_type}")")
|
||||
_compreply_candidates
|
||||
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
|
||||
;;
|
||||
*)
|
||||
candidates=('alias' 'completion' 'plugin')
|
||||
_compreply_candidates
|
||||
_bash-it-comp-enable-disable
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
_compreply_candidates
|
||||
;;
|
||||
esac
|
||||
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Activate completion for bash-it and its common misspellings
|
||||
complete -F _bash-it bash-it
|
||||
complete -F _bash-it bash-ti
|
||||
complete -F _bash-it shit
|
||||
complete -F _bash-it bashit
|
||||
complete -F _bash-it batshit
|
||||
complete -F _bash-it bash_it
|
||||
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
|
||||
|
|
|
|||
|
|
@ -5,26 +5,28 @@ about-completion "brew completion"
|
|||
# Load late to make sure `system` completion loads first
|
||||
# BASH_IT_LOAD_PRIORITY: 375
|
||||
|
||||
if [[ "$OSTYPE" != 'darwin'* ]]; then
|
||||
if [[ "$(uname -s)" != 'Darwin' ]]; then
|
||||
_log_warning "unsupported operating system - only 'Darwin' is supported"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Make sure brew is installed
|
||||
_bash_it_homebrew_check || return 0
|
||||
_command_exists brew || return 0
|
||||
|
||||
if [[ -r "$BASH_IT_HOMEBREW_PREFIX/etc/bash_completion.d/brew" ]]; then
|
||||
# shellcheck disable=1090,1091
|
||||
source "$BASH_IT_HOMEBREW_PREFIX/etc/bash_completion.d/brew"
|
||||
BREW_PREFIX=${BREW_PREFIX:-$(brew --prefix)}
|
||||
|
||||
elif [[ -r "$BASH_IT_HOMEBREW_PREFIX/Library/Contributions/brew_bash_completion.sh" ]]; then
|
||||
# shellcheck disable=1090,1091
|
||||
source "$BASH_IT_HOMEBREW_PREFIX/Library/Contributions/brew_bash_completion.sh"
|
||||
if [[ -r "$BREW_PREFIX"/etc/bash_completion.d/brew ]]; then
|
||||
# shellcheck disable=1090
|
||||
source "$BREW_PREFIX"/etc/bash_completion.d/brew
|
||||
|
||||
elif [[ -f "$BASH_IT_HOMEBREW_PREFIX/completions/bash/brew" ]]; then
|
||||
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,1091
|
||||
source "$BASH_IT_HOMEBREW_PREFIX/completions/bash/brew"
|
||||
# shellcheck disable=1090
|
||||
source "$BREW_PREFIX"/completions/bash/brew
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@ cite "about-completion"
|
|||
about-completion "composer completion"
|
||||
|
||||
function __composer_completion() {
|
||||
local cur coms opts com words
|
||||
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}"
|
||||
if [[ $word != -* ]]; then
|
||||
com=$word
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
|
@ -19,7 +19,7 @@ function __composer_completion() {
|
|||
if [[ ${cur} == --* ]]; then
|
||||
opts="--help --quiet --verbose --version --ansi --no-ansi --no-interaction --profile --no-plugins --working-dir"
|
||||
|
||||
case "${com}" in
|
||||
case "$com" in
|
||||
about)
|
||||
opts="${opts} "
|
||||
;;
|
||||
|
|
@ -109,18 +109,18 @@ function __composer_completion() {
|
|||
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
|
||||
__ltrim_colon_completions "${cur}"
|
||||
__ltrim_colon_completions "$cur"
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
# completing for a command
|
||||
if [[ "${cur}" == "${com}" ]]; then
|
||||
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}"
|
||||
__ltrim_colon_completions "$cur"
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@ cite "about-completion"
|
|||
about-completion "Hashicorp consul completion"
|
||||
|
||||
if _command_exists consul; then
|
||||
complete -C "$(command -v consul)" consul
|
||||
complete -C "$(which consul)" consul
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
__dart_completion() {
|
||||
# shellcheck disable=SC2155
|
||||
local prev=$(_get_pword)
|
||||
# shellcheck disable=SC2155
|
||||
local curr=$(_get_cword)
|
||||
|
||||
local HELP="--help -h"
|
||||
local VERBOSE="-v --verbose"
|
||||
|
||||
case $prev in
|
||||
analyze)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$HELP --fatal-infos --no-fatal-warnings --fatal-warnings" -- "$curr"))
|
||||
;;
|
||||
compile)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$HELP aot-snapshot exe js jit-snapshot kernel" -- "$curr"))
|
||||
;;
|
||||
create)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$HELP --template -t --no-pub --pub --force" -- "$curr"))
|
||||
;;
|
||||
-t | --template)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "console-simple console-full package-simple web-simple" -- "$curr"))
|
||||
;;
|
||||
format)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$HELP $VERBOSE -o --output --fix -l --line-length" -- "$curr"))
|
||||
;;
|
||||
pub)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$HELP $VERBOSE --version --no-trace --trace --verbosity cache deps downgrade get global logout outdated publish run upgrade uploader version" -- "$curr"))
|
||||
;;
|
||||
run)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$HELP --observe --enable-vm-service --no-pause-isolates-on-exit --no-pause-isolates-on-unhandled-exceptions --no-warn-on-pause-with-no-debugger --pause-isolates-on-exit --pause-isolates-on-unhandled-exceptions --warn-on-pause-with-no-debugger" -- "$curr"))
|
||||
;;
|
||||
dart)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$HELP $VERBOSE --version --enable-analytics --disable-analytics help analyze compile create format pub run test" -- "$curr"))
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
complete -F __dart_completion dart
|
||||
|
|
@ -1,5 +1,175 @@
|
|||
# shellcheck shell=bash
|
||||
# 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)
|
||||
|
||||
if test -s "${BASH_IT?}/vendor/github.com/gaelicWizard/bash-progcomp/defaults.completion.bash"; then
|
||||
source "$_"
|
||||
fi
|
||||
|
||||
_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,22 +0,0 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
function __dmidecode_completion() {
|
||||
# shellcheck disable=SC2155
|
||||
local prev=$(_get_pword)
|
||||
# shellcheck disable=SC2155
|
||||
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
|
||||
|
|
@ -676,7 +676,7 @@ _docker_compose() {
|
|||
done
|
||||
|
||||
local completions_func=_docker_compose_${command//-/_}
|
||||
_is_function $completions_func && $completions_func
|
||||
declare -F $completions_func >/dev/null && $completions_func
|
||||
|
||||
eval "$previous_extglob_setting"
|
||||
return 0
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
# shellcheck shell=bash
|
||||
about-completion "bash parameter completion for the dotnet CLI"
|
||||
# see https://docs.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete#bash
|
||||
|
||||
function _dotnet_bash_complete() {
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}" IFS=$'\n'
|
||||
local candidates
|
||||
|
||||
read -d '' -ra candidates < <(dotnet complete --position "${COMP_POINT}" "${COMP_LINE}" 2> /dev/null)
|
||||
|
||||
read -d '' -ra COMPREPLY < <(compgen -W "${candidates[*]:-}" -- "$cur")
|
||||
}
|
||||
|
||||
complete -f -F _dotnet_bash_complete dotnet
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Bash completion support for Fabric (http://fabfile.org/)
|
||||
#
|
||||
|
|
@ -41,8 +41,8 @@ export FAB_COMPLETION_CACHED_TASKS_FILENAME=".fab_tasks~"
|
|||
|
||||
|
||||
# Set command to get time of last file modification as seconds since Epoch
|
||||
case "$OSTYPE" in
|
||||
'darwin'*|'freebsd'*)
|
||||
case `uname` in
|
||||
Darwin|FreeBSD)
|
||||
__FAB_COMPLETION_MTIME_COMMAND="stat -f '%m'"
|
||||
;;
|
||||
*)
|
||||
|
|
@ -91,7 +91,7 @@ function __fab_completion() {
|
|||
-*)
|
||||
if [[ -z "${__FAB_COMPLETION_LONG_OPT}" ]]; then
|
||||
export __FAB_COMPLETION_LONG_OPT=$(
|
||||
fab --help | grep -E -o "\-\-[A-Za-z_\-]+\=?" | sort -u)
|
||||
fab --help | egrep -o "\-\-[A-Za-z_\-]+\=?" | sort -u)
|
||||
fi
|
||||
opts="${__FAB_COMPLETION_LONG_OPT}"
|
||||
;;
|
||||
|
|
@ -101,7 +101,7 @@ function __fab_completion() {
|
|||
# -*)
|
||||
# if [[ -z "${__FAB_COMPLETION_SHORT_OPT}" ]]; then
|
||||
# export __FAB_COMPLETION_SHORT_OPT=$(
|
||||
# fab --help | grep -E -o "^ +\-[A-Za-z_\]" | sort -u)
|
||||
# fab --help | egrep -o "^ +\-[A-Za-z_\]" | sort -u)
|
||||
# fi
|
||||
# opts="${__FAB_COMPLETION_SHORT_OPT}"
|
||||
# ;;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
#!/usr/bin/bash
|
||||
|
||||
if _command_exists flutter; then
|
||||
eval "$(flutter bash-completion)"
|
||||
|
|
|
|||
|
|
@ -1,35 +1,31 @@
|
|||
# shellcheck shell=bash
|
||||
#
|
||||
# Locate and load completions for `git`.
|
||||
#!/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
|
||||
_command_exists git || return 0
|
||||
|
||||
# Don't handle completion if it's already managed
|
||||
if complete -p git &> /dev/null; then
|
||||
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_xcrun_git=
|
||||
if _command_exists xcrun; then
|
||||
_git_bash_completion_xcrun_git="$(xcrun --find git)"
|
||||
fi
|
||||
_git_bash_completion_found=false
|
||||
_git_bash_completion_paths=(
|
||||
# Standard locations
|
||||
"${GIT_EXE%/*}/../share/git-core/git-completion.bash"
|
||||
"${GIT_EXE%/*}/../share/git-core/contrib/completion/git-completion.bash"
|
||||
"${GIT_EXE%/*}/../etc/bash_completion.d/git-completion.bash"
|
||||
# MacOS non-system locations
|
||||
"${_git_bash_completion_xcrun_git%/bin/git}/share/git-core/git-completion.bash"
|
||||
'/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
|
||||
_git_bash_completion_found=false
|
||||
for _comp_path in "${_git_bash_completion_paths[@]}"; do
|
||||
if [[ -r "$_comp_path" ]]; then
|
||||
for _comp_path in "${_git_bash_completion_paths[@]}" ; do
|
||||
if [ -r "$_comp_path" ] ; then
|
||||
_git_bash_completion_found=true
|
||||
# shellcheck disable=SC1090 # don't follow
|
||||
source "$_comp_path"
|
||||
break
|
||||
fi
|
||||
|
|
@ -39,4 +35,5 @@ done
|
|||
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@}"
|
||||
unset _git_bash_completion_paths
|
||||
unset _git_bash_completion_found
|
||||
|
|
|
|||
|
|
@ -172,7 +172,6 @@ __git_flow_list_hotfixes ()
|
|||
}
|
||||
|
||||
# temporarily wrap __git_find_on_cmdline() for backwards compatibility
|
||||
if ! _command_exists __git_find_subcommand
|
||||
then
|
||||
if [ -z "`type -t __git_find_subcommand`" ]; then
|
||||
alias __git_find_subcommand=__git_find_on_cmdline
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -505,7 +505,6 @@ __git_flow_list_branches ()
|
|||
}
|
||||
|
||||
# alias __git_find_on_cmdline for backwards compatibility
|
||||
if ! _command_exists __git_find_on_cmdline
|
||||
then
|
||||
if [ -z "`type -t __git_find_on_cmdline`" ]; then
|
||||
alias __git_find_on_cmdline=__git_find_subcommand
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
# Copyright (c) 2017 Eric Wendelin
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
|
@ -24,9 +22,17 @@
|
|||
# Avoid inaccurate completions for subproject tasks
|
||||
COMP_WORDBREAKS=$(echo "$COMP_WORDBREAKS" | sed -e 's/://g')
|
||||
|
||||
function __gradle-set-project-root-dir() {
|
||||
project_root_dir="$(_bash-it-find-in-ancestor "settings.gradle" "gradlew")"
|
||||
return "$?"
|
||||
__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() {
|
||||
|
|
@ -52,9 +58,9 @@ __gradle-set-cache-name() {
|
|||
|
||||
__gradle-set-files-checksum() {
|
||||
# Cache MD5 sum of all Gradle scripts and modified timestamps
|
||||
if _command_exists md5; then
|
||||
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 _command_exists md5sum; then
|
||||
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"
|
||||
|
|
@ -68,7 +74,7 @@ __gradle-generate-script-cache() {
|
|||
|
||||
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 | grep -E -v "$script_exclude_pattern")
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@
|
|||
# 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 ! _is_function _git && _is_function _completion_loader; then
|
||||
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 _is_function _git && ! _is_function __git_list_all_commands_without_hub; then
|
||||
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/')"
|
||||
|
|
@ -227,7 +227,7 @@ EOF
|
|||
((c++))
|
||||
done
|
||||
if [ -z "$name" ]; then
|
||||
repo="$(basename "${PWD}")"
|
||||
repo=$(basename "$(pwd)")
|
||||
fi
|
||||
case "$prev" in
|
||||
-d|-h)
|
||||
|
|
|
|||
|
|
@ -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 +1,160 @@
|
|||
# shellcheck shell=bash
|
||||
about-completion "jboss7 completion"
|
||||
# shellcheck disable=SC1090
|
||||
source "${BASH_IT}"/vendor/github.com/rparree/jboss-bash-completion/jboss7
|
||||
# Completions for JBoss Application Server 7 (EAP 6)
|
||||
# VERSION: 0.6
|
||||
# DATE: 2012-10-30
|
||||
# rparree-at-edc4it-dot-com
|
||||
|
||||
# MIT License
|
||||
|
||||
# Copyright (c) 2020 Raphael Parree
|
||||
|
||||
# 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.
|
||||
|
||||
_serverProfiles(){
|
||||
if [[ $COMP_WORDS == *standalone.sh* ]]
|
||||
then
|
||||
serverdir="../standalone/configuration/"
|
||||
else
|
||||
# assume is domain.sh
|
||||
serverdir="../domain/configuration/"
|
||||
fi
|
||||
|
||||
for i in ${!COMP_WORDS[*]}
|
||||
do
|
||||
if [[ "${COMP_WORDS[i]}" == "-Djboss.server.base.dir" || "${COMP_WORDS[i]}" == "-Djboss.domain.base.dir" ]]; then
|
||||
serverdir="${COMP_WORDS[i+2]}/configuration"
|
||||
fi
|
||||
|
||||
done
|
||||
if [ -d "${serverdir}" ]
|
||||
then
|
||||
|
||||
IFS=$'\n' tmp="$(ls "${serverdir}" | grep xml)"
|
||||
local fls="${tmp[@]// /\ }"
|
||||
unset IFS
|
||||
COMPREPLY=( $(compgen -W "${fls} initial boot last v" -- "$cur" ))
|
||||
fi
|
||||
}
|
||||
|
||||
_bindingAddress(){
|
||||
# from /etc/bash_completion.d/ssh
|
||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
|
||||
"0.0.0.0 $( PATH="$PATH:/sbin" ifconfig -a | \
|
||||
sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' \
|
||||
-ne 's/.*inet[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' )" \
|
||||
-- "$cur" ) )
|
||||
}
|
||||
|
||||
_jboss(){
|
||||
|
||||
local cur prev words cword
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref -n = cur prev words cword
|
||||
|
||||
case $cur in
|
||||
|
||||
-Djboss.socket.binding.port-offset=*)
|
||||
cur=${cur#*=}
|
||||
#static list of common bindings sets
|
||||
local bindings="100 200 300 400 10000 20000 30000 40000"
|
||||
COMPREPLY=( $(compgen -W "${bindings}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
-Djboss.default.jgroups.stack=*)
|
||||
cur=${cur#*=}
|
||||
#static list of standard JGroups stacks
|
||||
local stacks="udp udp-async udp-sync tcp tcp-sync"
|
||||
COMPREPLY=( $(compgen -W "${stacks}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
|
||||
-Dorg.jboss.ejb3.remoting.IsLocalInterceptor.passByRef=*|-Dcom.sun.management.jmxremote.authenticate=*|-Dcom.sun.management.jmxremote.ssl=*)
|
||||
cur=${cur#*=}
|
||||
local booleans="true false"
|
||||
COMPREPLY=( $(compgen -W "${booleans}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
|
||||
-Djboss.server.base.dir=*|-Djboss.home.dir=*|-Djboss.domain.base.dir=*)
|
||||
cur=${cur#*=}
|
||||
_filedir -d
|
||||
return 0
|
||||
;;
|
||||
|
||||
-Djboss.domain.master.address=*|-Djboss.bind.address*=*)
|
||||
cur=${cur#*=}
|
||||
_bindingAddress
|
||||
return 0
|
||||
;;
|
||||
--server-config=*|-c=|--host-config=*)
|
||||
cur=${cur#*=}
|
||||
_serverProfiles
|
||||
return 0
|
||||
|
||||
|
||||
esac
|
||||
|
||||
|
||||
case $prev in
|
||||
-u)
|
||||
# a few from RFC 2365 IPv4 Local Scope ()
|
||||
local addresses="239.255.0.1 239.255.0.2 239.255.0.3"
|
||||
COMPREPLY=( $(compgen -W "${addresses}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
-b*)
|
||||
_bindingAddress
|
||||
return 0
|
||||
;;
|
||||
-c)
|
||||
_serverProfiles
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
# *** from jboss5 ********************
|
||||
# *** -modulepath -c -m -g -l -d -p -n -B -L -C -Djboss.platform.mbeanserver -Djboss.server.base.directory
|
||||
# *** -Djboss.Domain -Djboss.modcluster.proxyList -Djboss.jvmRoute -Djboss.default.jgroups.stack -Dorg.jboss.ejb3.remoting.IsLocalInterceptor.passByRef -Djboss.platform.mbeanserver -Dcom.sun.management.jmxremote.port -Dcom.sun.management.jmxremote.ssl
|
||||
# *************************************
|
||||
|
||||
# standard commands for standalone and domain mode
|
||||
local commandsWithoutEqualSign='-b -bmanagement -bunsecure -bpublic --admin-only -h -help -u -version -V -v'
|
||||
local commandsWithEqualSign='-P -Djboss.node.name -Djboss.home.dir -Djboss.socket.binding.port-offset -Djboss.bind.address.management -Djboss.bind.address -Djboss.bind.address.unsecure'
|
||||
|
||||
if [[ $COMP_WORDS == *standalone.sh* ]]
|
||||
then
|
||||
commandsWithoutEqualSign="${commandsWithoutEqualSign} -c"
|
||||
commandsWithEqualSign="${commandsWithEqualSign} --server-config -Djboss.server.base.dir -c"
|
||||
else
|
||||
# assume is domain.sh
|
||||
commandsWithoutEqualSign="${commandsWithoutEqualSign} --backup --cached-dc"
|
||||
commandsWithEqualSign="${commandsWithEqualSign} -Djboss.domain.master.address --host-config -Djboss.domain.master.port -Djboss.domain.base.dir "
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
COMPREPLY=( $( compgen -W "$commandsWithoutEqualSign" -- "$cur" )
|
||||
$( compgen -W "$commandsWithEqualSign" -S '=' -- "$cur" ) )
|
||||
return 0
|
||||
|
||||
|
||||
}
|
||||
complete -o nospace -F _jboss standalone.sh
|
||||
complete -o nospace -F _jboss domain.sh
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ _KAC_is_file_newer_than() {
|
|||
_KAC_regen_cache() {
|
||||
local CACHE_NAME=$1
|
||||
local CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME"
|
||||
# shellcheck disable=SC2155
|
||||
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
|
||||
|
|
@ -55,19 +54,18 @@ _KAC_regen_cache() {
|
|||
|
||||
# cached files can't have spaces in their names
|
||||
_KAC_get_cache_name_from_command() {
|
||||
echo "${@// /_SPACE_}"
|
||||
echo "${@/ /_SPACE_}"
|
||||
}
|
||||
|
||||
# the reverse operation from the function above
|
||||
_KAC_get_command_from_cache_name() {
|
||||
echo "${@//_SPACE_/ }"
|
||||
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)
|
||||
# shellcheck disable=SC2155
|
||||
_KAC_get_and_regen_cache() {
|
||||
# the cache name can't have space in it
|
||||
local CACHE_NAME=$(_KAC_get_cache_name_from_command "$@")
|
||||
|
|
@ -102,7 +100,7 @@ _KAC_clean_cache() {
|
|||
|
||||
# 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.
|
||||
[[ -n "${KNIFE_CACHE_CLEAN}" ]] && _KAC_clean_cache
|
||||
[[ "${KNIFE_CACHE_CLEAN}" ]] && _KAC_clean_cache
|
||||
|
||||
#####################################
|
||||
### End of cache helper functions ###
|
||||
|
|
@ -120,7 +118,7 @@ _KAC_get_current_base_command() {
|
|||
local PREVIOUS="knife"
|
||||
local I=1
|
||||
local CURRENT
|
||||
while [[ "${I}" -le "${COMP_CWORD}" ]]; do
|
||||
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]}"
|
||||
|
|
@ -129,13 +127,12 @@ _KAC_get_current_base_command() {
|
|||
I=$((I + 1))
|
||||
done
|
||||
_KAC_CURRENT_COMMAND=$PREVIOUS
|
||||
[[ "${I}" -le "${COMP_CWORD}" ]] && _KAC_CURRENT_COMMAND_NB_WORDS="${I}"
|
||||
[ $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
|
||||
# shellcheck disable=SC2155
|
||||
_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")
|
||||
|
|
@ -153,11 +150,10 @@ _KAC_get_current_arg_position() {
|
|||
_knife() {
|
||||
_KAC_get_and_regen_cache _KAC_knife_commands
|
||||
local RAW_LIST ITEM REGEN_CMD ARG_POSITION
|
||||
# shellcheck disable=SC2034
|
||||
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)
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
# shellcheck shell=bash
|
||||
#!/usr/bin/bash
|
||||
|
||||
_command_exists laravel || return
|
||||
|
||||
function __laravel_completion() {
|
||||
local OPTS=('-h' '--help' '-q' '--quiet' '--ansi' '--no-ansi' '-n' '--no-interaction' '-v' '-vv' '-vvv' '--verbose' 'help' 'list' 'new')
|
||||
local _opt_
|
||||
if command -v laravel > /dev/null; then
|
||||
__laravel_completion() {
|
||||
local OPTS=("-h --help -q --quiet --ansi --no-ansi -n --no-interaction -v -vv -vvv --verbose help list new")
|
||||
COMPREPLY=()
|
||||
for _opt_ in "${OPTS[@]}"; do
|
||||
for _opt_ in ${OPTS[@]}; do
|
||||
if [[ "$_opt_" == "$2"* ]]; then
|
||||
COMPREPLY+=("$_opt_")
|
||||
fi
|
||||
done
|
||||
}
|
||||
}
|
||||
|
||||
complete -F __laravel_completion laravel
|
||||
complete -F __laravel_completion laravel
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
# Bash completion for Makefile
|
||||
# Loosely adapted from http://stackoverflow.com/a/38415982/1472048
|
||||
|
||||
|
|
@ -19,7 +17,7 @@ _makecomplete() {
|
|||
for f in "${files[@]}" ; do
|
||||
while IFS='' read -r line ; do
|
||||
targets+=("$line")
|
||||
done < <(grep -E -o '^[a-zA-Z0-9_-]+:([^=]|$)' "$f" | cut -d':' -f1)
|
||||
done < <(grep -oE '^[a-zA-Z0-9_-]+:([^=]|$)' "$f" | cut -d':' -f1)
|
||||
done
|
||||
|
||||
[ "${#targets[@]}" -eq 0 ] && return 0
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
__ngrok_completion() {
|
||||
# shellcheck disable=SC2155
|
||||
local prev=$(_get_pword)
|
||||
# shellcheck disable=SC2155
|
||||
local curr=$(_get_cword)
|
||||
|
||||
local BASE_NO_CONF="--log --log-format --log-level --help"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
function __notify-send_completions() {
|
||||
# shellcheck disable=SC2155
|
||||
local curr=$(_get_cword)
|
||||
# shellcheck disable=SC2155
|
||||
local prev=$(_get_pword)
|
||||
|
||||
case $prev in
|
||||
|
|
|
|||
|
|
@ -1,6 +1 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
if _command_exists pew
|
||||
then
|
||||
source "$(pew shell_config)"
|
||||
fi
|
||||
[[ -x "$(which pew)" ]] && source "$(pew shell_config)"
|
||||
|
|
|
|||
|
|
@ -6,15 +6,6 @@
|
|||
# If the pip package is installed within virtual environments, say, python managed by pyenv,
|
||||
# you should first initialize the corresponding environment.
|
||||
# So that pip is in the system's path.
|
||||
_command_exists pip || return
|
||||
|
||||
function __bash_it_complete_pip() {
|
||||
if _command_exists _pip_completion; then
|
||||
complete -o default -F _pip_completion pip
|
||||
_pip_completion "$@"
|
||||
else
|
||||
if _command_exists pip; then
|
||||
eval "$(pip completion --bash)"
|
||||
_pip_completion "$@"
|
||||
fi
|
||||
}
|
||||
complete -o default -F __bash_it_complete_pip pip
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -6,15 +6,6 @@
|
|||
# If the pip package is installed within virtual environments, say, python managed by pyenv,
|
||||
# you should first initialize the corresponding environment.
|
||||
# So that pip3 is in the system's path.
|
||||
_command_exists pip3 || return
|
||||
|
||||
function __bash_it_complete_pip3() {
|
||||
if _command_exists _pip_completion; then
|
||||
complete -o default -F _pip_completion pip3
|
||||
_pip_completion "$@"
|
||||
else
|
||||
if _command_exists pip3; then
|
||||
eval "$(pip3 completion --bash)"
|
||||
_pip_completion "$@"
|
||||
fi
|
||||
}
|
||||
complete -o default -F __bash_it_complete_pip3 pip3
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
if _command_exists pipenv; then
|
||||
eval "$(_PIPENV_COMPLETE=bash_source pipenv)"
|
||||
eval "$(pipenv --completion)"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ _is_function _rl_enabled ||
|
|||
_pj() {
|
||||
_is_function _init_completion || return
|
||||
_is_function _rl_enabled || return
|
||||
[ -n "$BASH_IT_PROJECT_PATHS" ] || return
|
||||
[ -n "$PROJECT_PATHS" ] || return
|
||||
shift
|
||||
[ "$1" == "open" ] && shift
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ _pj() {
|
|||
local -r mark_dirs=$(_rl_enabled mark-directories && echo y)
|
||||
local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y)
|
||||
|
||||
for i in ${BASH_IT_PROJECT_PATHS//:/$'\n'}; do
|
||||
for i in ${PROJECT_PATHS//:/$'\n'}; do
|
||||
# create an array of matched subdirs
|
||||
k="${#COMPREPLY[@]}"
|
||||
for j in $( compgen -d $i/$cur ); do
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
function _sdkman_complete() {
|
||||
_sdkman_complete() {
|
||||
local CANDIDATES
|
||||
local CANDIDATE_VERSIONS
|
||||
local SDKMAN_CANDIDATES_CSV="${SDKMAN_CANDIDATES_CSV:-}"
|
||||
|
||||
COMPREPLY=()
|
||||
|
||||
|
|
@ -12,7 +10,7 @@ function _sdkman_complete() {
|
|||
elif [ "$COMP_CWORD" -eq 2 ]; then
|
||||
case "${COMP_WORDS[COMP_CWORD - 1]}" in
|
||||
"install" | "i" | "uninstall" | "rm" | "list" | "ls" | "use" | "u" | "default" | "d" | "home" | "h" | "current" | "c" | "upgrade" | "ug")
|
||||
CANDIDATES="${SDKMAN_CANDIDATES_CSV//,/${IFS:0:1}}"
|
||||
CANDIDATES=$(echo "${SDKMAN_CANDIDATES_CSV}" | tr ',' ' ')
|
||||
mapfile -t COMPREPLY < <(compgen -W "$CANDIDATES" -- "${COMP_WORDS[COMP_CWORD]}")
|
||||
;;
|
||||
"env")
|
||||
|
|
@ -48,17 +46,17 @@ function _sdkman_complete() {
|
|||
return 0
|
||||
}
|
||||
|
||||
function _sdkman_candidate_local_versions() {
|
||||
_sdkman_candidate_local_versions() {
|
||||
|
||||
CANDIDATE_VERSIONS=$(__sdkman_cleanup_local_versions "$1")
|
||||
|
||||
}
|
||||
|
||||
function _sdkman_candidate_all_versions() {
|
||||
_sdkman_candidate_all_versions() {
|
||||
|
||||
candidate="$1"
|
||||
CANDIDATE_LOCAL_VERSIONS=$(__sdkman_cleanup_local_versions "$candidate")
|
||||
if [[ "${SDKMAN_OFFLINE_MODE:-false}" == "true" ]]; then
|
||||
if [ "$SDKMAN_OFFLINE_MODE" = "true" ]; then
|
||||
CANDIDATE_VERSIONS=$CANDIDATE_LOCAL_VERSIONS
|
||||
else
|
||||
# sdkman has a specific output format for Java candidate since
|
||||
|
|
@ -72,12 +70,12 @@ function _sdkman_candidate_all_versions() {
|
|||
# "+" - local version
|
||||
# "*" - installed
|
||||
# ">" - currently in use
|
||||
CANDIDATE_VERSIONS="$(echo "$CANDIDATE_ONLINE_VERSIONS $CANDIDATE_LOCAL_VERSIONS" | tr ' ' '\n' | grep -v -e '^[[:space:]|\*|\>|\+]*$' | sort -u) "
|
||||
CANDIDATE_VERSIONS="$(echo "$CANDIDATE_ONLINE_VERSIONS $CANDIDATE_LOCAL_VERSIONS" | tr ' ' '\n' | grep -v -e '^[[:space:]|\*|\>|\+]*$' | sort | uniq -u) "
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function __sdkman_cleanup_local_versions() {
|
||||
__sdkman_cleanup_local_versions() {
|
||||
|
||||
__sdkman_build_version_csv "$1" | tr ',' ' '
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# shellcheck shell=bash
|
||||
#!/bin/bash
|
||||
|
||||
# ---------------------------------------------------------------------------+
|
||||
# |
|
||||
|
|
@ -7,16 +7,15 @@
|
|||
# |
|
||||
# ---------------------------------------------------------------------------+
|
||||
|
||||
if _command_exists sqlmap
|
||||
then
|
||||
if command -v sqlmap > /dev/null; then
|
||||
|
||||
function _sqlmap()
|
||||
_sqlmap()
|
||||
{
|
||||
local cur prev
|
||||
|
||||
COMPREPLY=()
|
||||
cur="$(_get_cword)"
|
||||
prev="$(_get_pword)"
|
||||
cur=$(_get_cword)
|
||||
prev=$(_get_pword)
|
||||
|
||||
case $prev in
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,52 +1,25 @@
|
|||
# shellcheck shell=bash
|
||||
#
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Loads the system's Bash completion modules.
|
||||
# If Homebrew is installed (OS X), it's Bash completion modules are loaded.
|
||||
|
||||
# Load before other completions
|
||||
# BASH_IT_LOAD_PRIORITY: 325
|
||||
|
||||
# Bash-completion is too large and complex to expect to handle unbound variables throughout the whole codebase.
|
||||
if shopt -qo nounset; then
|
||||
__bash_it_restore_nounset=true
|
||||
shopt -uo nounset
|
||||
else
|
||||
__bash_it_restore_nounset=false
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC1090 disable=SC1091
|
||||
if [[ -r "${BASH_COMPLETION:-}" ]]; then
|
||||
source "${BASH_COMPLETION}"
|
||||
elif [[ -r /etc/bash_completion ]]; then
|
||||
if [[ -r /etc/bash_completion ]] ; then
|
||||
# shellcheck disable=SC1091
|
||||
source /etc/bash_completion
|
||||
|
||||
# Some distribution makes use of a profile.d script to import completion.
|
||||
elif [[ -r /etc/profile.d/bash_completion.sh ]]; then
|
||||
elif [[ -r /etc/profile.d/bash_completion.sh ]] ; then
|
||||
# shellcheck disable=SC1091
|
||||
source /etc/profile.d/bash_completion.sh
|
||||
elif _bash_it_homebrew_check; then
|
||||
: "${BASH_COMPLETION_COMPAT_DIR:=${BASH_IT_HOMEBREW_PREFIX}/etc/bash_completion.d}"
|
||||
case "${BASH_VERSION}" in
|
||||
1* | 2* | 3.0* | 3.1*)
|
||||
_log_warning "Cannot load completion due to version of shell. Are you using Bash 3.2+?"
|
||||
;;
|
||||
3.2* | 4.0* | 4.1*)
|
||||
# Import version 1.x of bash-completion, if installed.
|
||||
BASH_COMPLETION="${BASH_IT_HOMEBREW_PREFIX}/opt/bash-completion@1/etc/bash_completion"
|
||||
if [[ -r "$BASH_COMPLETION" ]]; then
|
||||
source "$BASH_COMPLETION"
|
||||
else
|
||||
unset BASH_COMPLETION
|
||||
fi
|
||||
;;
|
||||
4.2* | 5* | *)
|
||||
# homebrew/versions/bash-completion2 (required for projects.completion.bash) is installed to this path
|
||||
if [[ -r "${BASH_IT_HOMEBREW_PREFIX}/opt/bash-completion@2/etc/profile.d/bash_completion.sh" ]]; then
|
||||
source "${BASH_IT_HOMEBREW_PREFIX}/opt/bash-completion@2/etc/profile.d/bash_completion.sh"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
if [[ ${__bash_it_restore_nounset:-false} == "true" ]]; then
|
||||
shopt -so nounset
|
||||
if [[ "$(uname -s)" == 'Darwin' ]] && _command_exists brew ; then
|
||||
BREW_PREFIX=${BREW_PREFIX:-$(brew --prefix)}
|
||||
|
||||
# homebrew/versions/bash-completion2 (required for projects.completion.bash) is installed to this path
|
||||
if [[ -r "$BREW_PREFIX"/etc/profile.d/bash_completion.sh ]] ; then
|
||||
# shellcheck disable=SC1090
|
||||
source "$BREW_PREFIX"/etc/profile.d/bash_completion.sh
|
||||
fi
|
||||
fi
|
||||
unset __bash_it_restore_nounset
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
if _command_exists travis
|
||||
then
|
||||
if [[ -s "${__TRAVIS_COMPLETION_SCRIPT:=${TRAVIS_CONFIG_PATH:-${HOME}/.travis}/travis.sh}" ]]
|
||||
then
|
||||
source "${__TRAVIS_COMPLETION_SCRIPT}"
|
||||
fi
|
||||
if [[ -x "$(which travis)" ]]; then
|
||||
__TRAVIS_COMPLETION_SCRIPT="${TRAVIS_CONFIG_PATH:-${HOME}/.travis}/travis.sh"
|
||||
[[ -f "${__TRAVIS_COMPLETION_SCRIPT}" ]] && source "${__TRAVIS_COMPLETION_SCRIPT}"
|
||||
unset __TRAVIS_COMPLETION_SCRIPT
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
__vuejs_completion() {
|
||||
# shellcheck disable=SC2155
|
||||
local prev=$(_get_pword)
|
||||
# shellcheck disable=SC2155
|
||||
local curr=$(_get_cword)
|
||||
|
||||
case $prev in
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
# shellcheck shell=bash
|
||||
#!/usr/bin/bash
|
||||
|
||||
_command_exists wpscan || return
|
||||
|
||||
function __wpscan_completion() {
|
||||
local _opt_
|
||||
local OPTS=('--help' '--hh' '--version' '--url' '--ignore-main-redirect' '--verbose' '--output' '--format' '--detection-mode' '--scope' '--headers' '--user-agent' '--vhost' '--random-user-agent' '--user-agents-list' '--http-auth' '--max-threads' '--throttle' '--request-timeout' '--connect-timeout' '--disable-tlc-checks' '--proxy' '--proxy-auth' '--cookie-string' '--cookie-jar' '--cache-ttl' '--clear-cache' '--server' '--cache-dir' '--update' '--no-update' '--wp-content-dir' '--wp-plugins-dir' '--wp-version-detection' '--main-theme-detection' '--enumerate' '--exclude-content-based' '--plugins-list' '--plugins-detection' '--plugins-version-all' '--plugins-version-detection' '--themes-list' '--themes-detection' '--themes-version-all' '--themes-version-detection' '--timthumbs-list' '--timthumbs-detection' '--config-backups-list' '--config-backups-detection' '--db-exports-list' '--db-exports-detection' '--medias-detection' '--users-list' '--users-detection' '--passwords' '--usernames' '--multicall-max-passwords' '--password-attack' '--stealthy')
|
||||
if command -v wpscan > /dev/null; then
|
||||
__wpscan_completion() {
|
||||
local OPTS=("--help --hh --version --url --ignore-main-redirect --verbose --output --format --detection-mode --scope --headers --user-agent --vhost --random-user-agent --user-agents-list --http-auth --max-threads --throttle --request-timeout --connect-timeout --disable-tlc-checks --proxy --proxy-auth --cookie-string --cookie-jar --cache-ttl --clear-cache --server --cache-dir --update --no-update --wp-content-dir --wp-plugins-dir --wp-version-detection --main-theme-detection --enumerate --exclude-content-based --plugins-list --plugins-detection --plugins-version-all --plugins-version-detection --themes-list --themes-detection --themes-version-all --themes-version-detection --timthumbs-list --timthumbs-detection --config-backups-list --config-backups-detection --db-exports-list --db-exports-detection --medias-detection --users-list --users-detection --passwords --usernames --multicall-max-passwords --password-attack --stealthy")
|
||||
COMPREPLY=()
|
||||
for _opt_ in "${OPTS[@]}"; do
|
||||
for _opt_ in ${OPTS[@]}; do
|
||||
if [[ "$_opt_" == "$2"* ]]; then
|
||||
COMPREPLY+=("$_opt_")
|
||||
fi
|
||||
done
|
||||
}
|
||||
}
|
||||
|
||||
complete -F __wpscan_completion wpscan
|
||||
complete -F __wpscan_completion wpscan
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
# shellcheck shell=bash
|
||||
about-completion "yarn cli completions"
|
||||
|
||||
# shellcheck disable=SC1090 source=../../vendor/github.com/dsifford/yarn-completion/yarn
|
||||
source "${BASH_IT}/vendor/github.com/dsifford/yarn-completion/yarn"
|
||||
|
|
@ -1,9 +1,7 @@
|
|||

|
||||
|
||||

|
||||
# Bash-it
|
||||

|
||||

|
||||

|
||||

|
||||
[](https://webchat.freenode.net/?channel=#bash-it)
|
||||
|
||||
**Bash-it** is a collection of community Bash commands and scripts for Bash 3.2+.
|
||||
(And a shameless ripoff of [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) :smiley:)
|
||||
|
|
@ -41,8 +39,7 @@ Stop polluting your `~/bin` directory and your `.bashrc` file, fork/clone Bash-i
|
|||
``git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it``
|
||||
2) Run ``~/.bash_it/install.sh``
|
||||
|
||||
That's it! :smiley:
|
||||
|
||||
Thats it! :smiley:
|
||||
You can check out more components of Bash-it, and customize it to your desire.
|
||||
For more information, see detailed instructions [here](https://bash-it.readthedocs.io/en/latest/installation/).
|
||||
|
||||
|
|
@ -56,8 +53,10 @@ please feel free to read through this page if you're interested in how Bash-it l
|
|||
|
||||
## Contributors
|
||||
|
||||
[List of contributors](https://github.com/Bash-it/bash-it/contributors)
|
||||
* [List of contributors][contribute]
|
||||
|
||||
## License
|
||||
|
||||
Bash-it is licensed under the [MIT License](https://github.com/Bash-it/bash-it/blob/master/LICENSE).
|
||||
|
||||
[contribute]: https://github.com/Bash-it/bash-it/contributors
|
||||
|
|
|
|||
|
|
@ -13,4 +13,3 @@ You should be familiar with them in order to fully utilize Bash-it.
|
|||
search
|
||||
reload
|
||||
doctor
|
||||
profile
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue