Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5487963fa7 | ||
|
|
0565c3aa8e | ||
|
|
8e73b538ea | ||
|
|
012552d8b7 | ||
|
|
a369cc7c0a | ||
|
|
cd44880c15 | ||
|
|
292da7ef77 | ||
|
|
59439c2f62 | ||
|
|
8cc7327c0b | ||
|
|
5188b3b0c0 | ||
|
|
334005ead3 | ||
|
|
6eb5802080 | ||
|
|
3ba1a14eb9 | ||
|
|
f4f229573d | ||
|
|
6a69931240 | ||
|
|
f221cdca9e | ||
|
|
17211b0b1a | ||
|
|
2329b4395b | ||
|
|
3a2ccd3792 | ||
|
|
1d4b325ce9 | ||
|
|
a1da0087a1 | ||
|
|
d6e2b04708 | ||
|
|
908fed9f50 | ||
|
|
13e795c995 | ||
|
|
e94b9420ac | ||
|
|
b119540ce7 | ||
|
|
d2a5524556 | ||
|
|
921ea9ac76 | ||
|
|
b19c2b969f | ||
|
|
d74cc615be | ||
|
|
5aa2612ff1 | ||
|
|
6914a2345a | ||
|
|
8bc83b2d48 | ||
|
|
9ca6841e20 | ||
|
|
e1372dd5bd | ||
|
|
7edc26f408 | ||
|
|
d00c478ded | ||
|
|
13be44ab19 | ||
|
|
181863af1d | ||
|
|
859038e58f | ||
|
|
501b1ab3b5 | ||
|
|
89787cf261 | ||
|
|
2b4a81f39c | ||
|
|
5eb023cf51 | ||
|
|
6008006783 | ||
|
|
f10834275f | ||
|
|
1c05d71819 | ||
|
|
f5753e4416 | ||
|
|
654a49cbd8 | ||
|
|
b5fecb3eb3 | ||
|
|
0d7f145ef4 | ||
|
|
dca563e606 | ||
|
|
cf2df9e896 | ||
|
|
a1760af43b | ||
|
|
e873252227 |
@@ -9,7 +9,7 @@ charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
[*.{md,rst}]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[.git*]
|
||||
|
||||
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -1,5 +1,9 @@
|
||||
*.sh text eol=lf
|
||||
*.bash text eol=lf
|
||||
|
||||
# Docs allow trailing whitespaces
|
||||
*.md whitespace=-blank-at-eol
|
||||
*.rst whitespace=-blank-at-eol
|
||||
|
||||
# Windows files
|
||||
*.bat text eol=crlf
|
||||
|
||||
46
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
46
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -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
|
||||
```
|
||||
23
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
23
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -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 -->
|
||||
30
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
30
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<!--- Provide a general summary of your changes in the Title above -->
|
||||
|
||||
## Description
|
||||
<!--- Describe your changes in detail -->
|
||||
|
||||
## Motivation and Context
|
||||
<!--- Why is this change required? What problem does it solve? -->
|
||||
<!--- If it fixes an open issue, please link to the issue here. -->
|
||||
|
||||
## How Has This Been Tested?
|
||||
<!--- Please describe in detail how you tested your changes. -->
|
||||
<!--- Include details of your testing environment, and the tests you ran to -->
|
||||
<!--- see how your change affects other areas of the code, etc. -->
|
||||
|
||||
## Screenshots (if appropriate):
|
||||
|
||||
## Types of changes
|
||||
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
||||
|
||||
## Checklist:
|
||||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
|
||||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
|
||||
- [ ] My code follows the code style of this project.
|
||||
- [ ] If my change requires a change to the documentation, I have updated the documentation accordingly.
|
||||
- [ ] I have read the **CONTRIBUTING** document.
|
||||
- [ ] If I have added a new file, I also added it to ``clean_files.txt`` and formatted it using ``lint_clean_files.sh``.
|
||||
- [ ] I have added tests to cover my changes, and all the new and existing tests pass.
|
||||
@@ -9,6 +9,7 @@ repos:
|
||||
rev: v2.3.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
exclude: ".(md|rst)$"
|
||||
- id: end-of-file-fixer
|
||||
- id: check-merge-conflict
|
||||
- id: mixed-line-ending
|
||||
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
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
|
||||
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.
|
||||
@@ -5,7 +5,12 @@ VIM=$(command -v vim)
|
||||
GVIM=$(command -v gvim)
|
||||
MVIM=$(command -v mvim)
|
||||
|
||||
[[ -n $VIM ]] && alias v=$VIM
|
||||
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
|
||||
|
||||
@@ -74,6 +74,9 @@ if [[ ! -z "${BASH_IT_THEME}" ]]; then
|
||||
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"
|
||||
|
||||
@@ -32,5 +32,10 @@ themes/powerline
|
||||
#
|
||||
completion/available/cargo.completion.bash
|
||||
completion/available/knife.completion.bash
|
||||
completion/available/packer.completion.bash
|
||||
completion/available/pipx.completion.bash
|
||||
completion/available/rustup.completion.bash
|
||||
completion/available/vault.completion.bash
|
||||
|
||||
# aliases
|
||||
aliases/available/vim.aliases.bash
|
||||
|
||||
@@ -1,6 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# apm-bash-completion is written by Ugur Ozyilmazel
|
||||
# The MIT License (MIT)
|
||||
|
||||
# Copyright (c) 2015 Uğur "vigo" Özyılmazel
|
||||
|
||||
# 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.
|
||||
|
||||
# repo: https://github.com/vigo/apm-bash-completion
|
||||
|
||||
__apm(){
|
||||
|
||||
@@ -1,9 +1,28 @@
|
||||
#! bash
|
||||
# bash completion for the `bundle` command.
|
||||
#
|
||||
# Copyright (c) 2011-2017 Daniel Luz <dev at mernen dot com>.
|
||||
# Distributed under the MIT license.
|
||||
# http://mernen.com/projects/completion-ruby
|
||||
# Copyright (c) 2008 Daniel Luz
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation
|
||||
# files (the "Software"), to deal in the Software without
|
||||
# restriction, including without limitation the rights to use,
|
||||
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following
|
||||
# conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# To use, source this file on bash:
|
||||
# . completion-bundle
|
||||
|
||||
@@ -30,6 +30,36 @@
|
||||
# ============
|
||||
#
|
||||
# To uninstall, just remove the line from your .bash_profile and .bashrc.
|
||||
#
|
||||
# This file is licensed under the following license:
|
||||
# Copyright (c) Django Software Foundation and individual contributors.
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
|
||||
# 2. 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.
|
||||
|
||||
# 3. Neither the name of Django 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.
|
||||
|
||||
|
||||
_django_completion()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Copyright (c) 2014 Docker, Inc
|
||||
|
||||
# bash completion for docker-compose
|
||||
#
|
||||
# This work is based on the completion for the docker command.
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
#
|
||||
# bash completion file for docker-machine commands
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Copyright (c) 2014 Docker, Inc
|
||||
|
||||
#
|
||||
# This script provides completion of:
|
||||
# - commands and their options
|
||||
|
||||
@@ -1,37 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# bash completion support for Drush:
|
||||
# https://github.com/drush-ops/drush
|
||||
#
|
||||
# Originally from:
|
||||
# http://github.com/drush-ops/drush/blob/master/drush.complete.sh
|
||||
|
||||
# Ensure drush is available.
|
||||
which drush &> /dev/null || alias drush &> /dev/null || return
|
||||
|
||||
__drush_ps1() {
|
||||
f="${TMPDIR:-/tmp/}/drush-env/drush-drupal-site-$$"
|
||||
if [ -f $f ]
|
||||
then
|
||||
__DRUPAL_SITE=$(cat "$f")
|
||||
else
|
||||
__DRUPAL_SITE="$DRUPAL_SITE"
|
||||
fi
|
||||
|
||||
[[ -n "$__DRUPAL_SITE" ]] && printf "${1:- (%s)}" "$__DRUPAL_SITE"
|
||||
}
|
||||
|
||||
# Completion function, uses the "drush complete" command to retrieve
|
||||
# completions for a specific command line COMP_WORDS.
|
||||
_drush_completion() {
|
||||
# Set IFS to newline (locally), since we only use newline separators, and
|
||||
# need to retain spaces (or not) after completions.
|
||||
local IFS=$'\n'
|
||||
# The '< /dev/null' is a work around for a bug in php libedit stdin handling.
|
||||
# Note that libedit in place of libreadline in some distributions. See:
|
||||
# https://bugs.launchpad.net/ubuntu/+source/php5/+bug/322214
|
||||
COMPREPLY=( $(drush --early=includes/complete.inc "${COMP_WORDS[@]}" < /dev/null 2> /dev/null) )
|
||||
}
|
||||
|
||||
# Register our completion function. We include common short aliases for Drush.
|
||||
complete -o bashdefault -o default -o nospace -F _drush_completion d dr drush drush5 drush6 drush6 drush.php
|
||||
_log_error 'Bash completion for "drush" is now deprecated, as it used code with incompatible license.
|
||||
Please disable this completion and use the instructions from "drush" developers instead.'
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
# Copyright (c) 2017 Eric Wendelin
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
# of the Software, and to permit persons to whom the Software is furnished to do
|
||||
# so, subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
# Bash breaks words on : by default. Subproject tasks have ':'
|
||||
# Avoid inaccurate completions for subproject tasks
|
||||
COMP_WORDBREAKS=$(echo "$COMP_WORDBREAKS" | sed -e 's/://g')
|
||||
|
||||
@@ -3,9 +3,35 @@
|
||||
# grunt-cli
|
||||
# http://gruntjs.com/
|
||||
#
|
||||
# Copyright (c) 2012 Tyler Kellen, contributors
|
||||
# Licensed under the MIT license.
|
||||
# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
|
||||
# Copyright jQuery Foundation and other contributors, https://jquery.org/
|
||||
|
||||
# This software consists of voluntary contributions made by many
|
||||
# individuals. For exact contribution history, see the revision history
|
||||
# available at https://github.com/gruntjs/grunt .
|
||||
|
||||
# The following license applies to all parts of this software except as
|
||||
# documented below:
|
||||
|
||||
# ====
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# Usage:
|
||||
#
|
||||
|
||||
@@ -2,9 +2,36 @@
|
||||
# Borrowed from grunt-cli
|
||||
# http://gruntjs.com/
|
||||
#
|
||||
# Copyright (c) 2012 Tyler Kellen, contributors
|
||||
# Licensed under the MIT license.
|
||||
# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
|
||||
# Copyright jQuery Foundation and other contributors, https://jquery.org/
|
||||
|
||||
# This software consists of voluntary contributions made by many
|
||||
# individuals. For exact contribution history, see the revision history
|
||||
# available at https://github.com/gruntjs/grunt .
|
||||
|
||||
# The following license applies to all parts of this software except as
|
||||
# documented below:
|
||||
|
||||
# ====
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# Usage:
|
||||
#
|
||||
# To enable bash <tab> completion for gulp, add the following line (minus the
|
||||
|
||||
@@ -1,59 +1,2 @@
|
||||
# Bash completion script for homesick
|
||||
#
|
||||
# The homebrew bash completion script was used as inspiration.
|
||||
# Originally from https://github.com/liborw/homesick-completion
|
||||
|
||||
_homesick_complete()
|
||||
{
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
local options="--skip --force --pretend --quiet"
|
||||
local actions="cd clone commit destroy diff generate help list open pull push rc show_path status symlink track unlink version"
|
||||
local repos=$(\ls ~/.homesick/repos)
|
||||
|
||||
# Subcommand list
|
||||
[[ ${COMP_CWORD} -eq 1 ]] && {
|
||||
COMPREPLY=( $(compgen -W "${options} ${actions}" -- ${cur}) )
|
||||
return
|
||||
}
|
||||
|
||||
# Find the first non-switch word
|
||||
local prev_index=1
|
||||
local prev="${COMP_WORDS[prev_index]}"
|
||||
while [[ $prev == -* ]]; do
|
||||
prev_index=$((++prev_index))
|
||||
prev="${COMP_WORDS[prev_index]}"
|
||||
done
|
||||
|
||||
# Find the number of non-"--" commands
|
||||
local num=0
|
||||
for word in ${COMP_WORDS[@]}
|
||||
do
|
||||
if [[ $word != -* ]]; then
|
||||
num=$((++num))
|
||||
fi
|
||||
done
|
||||
|
||||
case "$prev" in
|
||||
# Commands that take a castle
|
||||
cd|commit|destroy|diff|open|pull|push|rc|show_path|status|symlink|unlink)
|
||||
COMPREPLY=( $(compgen -W "${repos}" -- ${cur}) )
|
||||
return
|
||||
;;
|
||||
# Commands that take command
|
||||
help)
|
||||
COMPREPLY=( $(compgen -W "${actions}" -- ${cur}) )
|
||||
return
|
||||
;;
|
||||
# Track command take file and repo
|
||||
track)
|
||||
if [[ "$num" -eq 2 ]]; then
|
||||
COMPREPLY=( $(compgen -X -f ${cur}) )
|
||||
elif [[ "$num" -ge 3 ]]; then
|
||||
COMPREPLY=( $(compgen -W "${repos}" -- ${cur}) )
|
||||
fi
|
||||
return
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
complete -o bashdefault -o default -F _homesick_complete homesick
|
||||
_log_error 'Bash completion for "homesick" is now deprecated, as it used unlicensed code.
|
||||
Please disable this completion and use the instructions from "homesick" bash completion developers instead.'
|
||||
|
||||
@@ -1,6 +1,27 @@
|
||||
# hub tab-completion script for bash.
|
||||
# This script complements the completion script that ships with git.
|
||||
|
||||
# Copyright (c) 2009 Chris Wanstrath
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# If there is no git tab completion, but we have the _completion loader try to load it
|
||||
if ! declare -F _git > /dev/null && declare -F _completion_loader > /dev/null; then
|
||||
_completion_loader git
|
||||
|
||||
@@ -1,4 +1,28 @@
|
||||
# Invoke (pyinvoke.org) tab-completion script to be sourced with Bash shell.
|
||||
|
||||
# Copyright (c) 2020 Jeff Forcier.
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# https://github.com/pyinvoke/invoke/blob/master/completion/bash
|
||||
|
||||
_complete_invoke() {
|
||||
|
||||
@@ -3,8 +3,27 @@
|
||||
# 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* ]]
|
||||
|
||||
@@ -1,163 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
cite "about-completion"
|
||||
about-completion "packer completion"
|
||||
|
||||
# Packer (http://www.packer.io) bash completion
|
||||
#
|
||||
# This script provides bash completion for packer and supports:
|
||||
#
|
||||
# - template filename completion (*.json) in cwd
|
||||
# - support for basic options (i.e.. -debug)
|
||||
# - support for complex options (i.e. -parallel=[true|false]
|
||||
#
|
||||
# The scirpt has been successfully tested with packer-0.6.0 and the
|
||||
# following OS:
|
||||
#
|
||||
# - OS X 10.9
|
||||
# - CentOS-6.5
|
||||
# - Ubuntu 12.04 Server
|
||||
#
|
||||
# The script technically is heavily inspired by the git-completion.bash
|
||||
# script. Kudos to Shawn O. Pearce <spearce@spearce.org> and all other
|
||||
# contributors for the inspiration and especially to the bash-completion
|
||||
# team in general.
|
||||
#
|
||||
# Copyright (c) 2014 IT Services Department, University of Bern
|
||||
#
|
||||
# This script is licensed under the MIT License (MIT)
|
||||
# For licsense details see the LICENSE file included in the repository
|
||||
# or read the license text at http://opensource.org/licenses/MIT.
|
||||
#
|
||||
|
||||
# Generates completion reply, appending a space to possible completion words,
|
||||
# if necessary.
|
||||
# It accepts 2 arguments though the second is optional:
|
||||
# 1: List of possible completion words.
|
||||
# 2: Generate possible completion matches for this word (optional).
|
||||
__packercomp ()
|
||||
{
|
||||
local cur_="${2-$cur}"
|
||||
|
||||
case "$cur_" in
|
||||
-*=)
|
||||
;;
|
||||
*)
|
||||
local c i=0 IFS=$' \t\n'
|
||||
for c in $1; do
|
||||
if [[ $c == "$cur_"* ]]; then
|
||||
case $c in
|
||||
-*=*|*.) ;;
|
||||
*) c="$c " ;;
|
||||
esac
|
||||
COMPREPLY[i++]="$c"
|
||||
if _binary_exists packer; then
|
||||
complete -C packer packer
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Generates completion reply for template files in cwd.
|
||||
__packercomp_template_file ()
|
||||
{
|
||||
local IFS=$'\n'
|
||||
|
||||
COMPREPLY=($(compgen -S " " -A file -X '!*.json' -- "${cur}"))
|
||||
}
|
||||
|
||||
# Generates completion for the build command.
|
||||
__packer_build ()
|
||||
{
|
||||
local builders="
|
||||
amazon-ebs amazon-instance amazon-chroot digitalocean docker
|
||||
googlecompute openstack parallels-iso parallels-pvm qemu
|
||||
virtualbox-iso virtualbox-ovf vmware-iso vmware-vmx"
|
||||
|
||||
case "$cur" in
|
||||
-parallel=*)
|
||||
__packercomp "false true" "${cur##-parallel=}"
|
||||
return
|
||||
;;
|
||||
-except=*)
|
||||
__packercomp "$builders" "${cur##-except=}"
|
||||
return
|
||||
;;
|
||||
-only=*)
|
||||
__packercomp "$builders" "${cur##-only=}"
|
||||
return
|
||||
;;
|
||||
-*)
|
||||
__packercomp "-debug -force -machine-readable -except= -only= -parallel= -var -var-file"
|
||||
return
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
|
||||
__packercomp_template_file
|
||||
}
|
||||
|
||||
# Generates completion for the fix command.
|
||||
__packer_fix ()
|
||||
{
|
||||
__packercomp_template_file
|
||||
}
|
||||
|
||||
# Generates completion for the inspect command.
|
||||
__packer_inspect ()
|
||||
{
|
||||
case "$cur" in
|
||||
-*)
|
||||
__packercomp "-machine-readable"
|
||||
return
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
|
||||
__packercomp_template_file
|
||||
}
|
||||
|
||||
# Generates completion for the validate command.
|
||||
__packer_validate ()
|
||||
{
|
||||
__packercomp_template_file
|
||||
}
|
||||
|
||||
# Main function for packer completion.
|
||||
#
|
||||
# Searches for a command in $COMP_WORDS. If one is found
|
||||
# the appropriate function from above is called, if not
|
||||
# completion for global options is done.
|
||||
_packer_completion ()
|
||||
{
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
# Words containing an equal sign get split into tokens in bash > 4, which
|
||||
# doesn't come in handy here.
|
||||
# This is handled here. bash < 4 does not split.
|
||||
declare -f _get_comp_words_by_ref >/dev/null && _get_comp_words_by_ref -n = cur
|
||||
|
||||
COMPREPLY=()
|
||||
local i c=1 command
|
||||
|
||||
while [ $c -lt $COMP_CWORD ]; do
|
||||
i="${COMP_WORDS[c]}"
|
||||
case "$i" in
|
||||
-*) ;;
|
||||
*) command="$i"; break ;;
|
||||
esac
|
||||
((c++))
|
||||
done
|
||||
|
||||
if [ -z $command ]; then
|
||||
case "$cur" in
|
||||
'-'*)
|
||||
__packercomp "-machine-readable --help --version"
|
||||
;;
|
||||
*)
|
||||
__packercomp "build fix inspect validate"
|
||||
;;
|
||||
esac
|
||||
return
|
||||
fi
|
||||
|
||||
local completion_func="__packer_${command}"
|
||||
declare -f $completion_func >/dev/null && $completion_func
|
||||
}
|
||||
|
||||
complete -o nospace -F _packer_completion packer
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Copyright (c) 2020 SaltStack Team
|
||||
|
||||
# Original Author:
|
||||
# written by David Pravec
|
||||
# - feel free to /msg alekibango on IRC if you want to talk about this file
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
# tmux completion
|
||||
# See: http://www.debian-administration.org/articles/317 for how to write more.
|
||||
# Usage: Put "source bash_completion_tmux.sh" into your .bashrc
|
||||
# Based upon the example at http://paste-it.appspot.com/Pj4mLycDE
|
||||
|
||||
_tmux_expand ()
|
||||
{
|
||||
|
||||
@@ -1,70 +1,2 @@
|
||||
# link: https://github.com/ginatrapani/todo.txt-cli/blob/master/todo_completion
|
||||
|
||||
_todo()
|
||||
{
|
||||
local cur prev opts
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
local -r OPTS="-@ -@@ -+ -++ -d -f -h -p -P -PP -a -n -t -v -vv -V -x"
|
||||
local -r COMMANDS="\
|
||||
add a addto addm append app archive command del \
|
||||
rm depri dp do help list ls listaddons listall lsa listcon \
|
||||
lsc listfile lf listpri lsp listproj lsprj move \
|
||||
mv prepend prep pri p replace report shorthelp"
|
||||
local -r MOVE_COMMAND_PATTERN='^(move|mv)$'
|
||||
|
||||
local _todo_sh=${_todo_sh:-todo.sh}
|
||||
local completions
|
||||
if [ $COMP_CWORD -eq 1 ]; then
|
||||
completions="$COMMANDS $(eval TODOTXT_VERBOSE=0 $_todo_sh command listaddons) $OPTS"
|
||||
elif [[ $COMP_CWORD -gt 2 && ( \
|
||||
"${COMP_WORDS[COMP_CWORD-2]}" =~ $MOVE_COMMAND_PATTERN || \
|
||||
"${COMP_WORDS[COMP_CWORD-3]}" =~ $MOVE_COMMAND_PATTERN ) ]]; then
|
||||
completions=$(eval TODOTXT_VERBOSE=0 $_todo_sh command listfile)
|
||||
else
|
||||
case "$prev" in
|
||||
command)
|
||||
completions=$COMMANDS;;
|
||||
help)
|
||||
completions="$COMMANDS $(eval TODOTXT_VERBOSE=0 $_todo_sh command listaddons)";;
|
||||
addto|listfile|lf)
|
||||
completions=$(eval TODOTXT_VERBOSE=0 $_todo_sh command listfile);;
|
||||
-*) completions="$COMMANDS $(eval TODOTXT_VERBOSE=0 $_todo_sh command listaddons) $OPTS";;
|
||||
*) case "$cur" in
|
||||
+*) completions=$(eval TODOTXT_VERBOSE=0 $_todo_sh command listproj)
|
||||
COMPREPLY=( $( compgen -W "$completions" -- $cur ))
|
||||
[ ${#COMPREPLY[@]} -gt 0 ] && return 0
|
||||
completions=$(eval 'TODOTXT_VERBOSE=0 TODOTXT_SOURCEVAR=\$DONE_FILE' $_todo_sh command listproj)
|
||||
;;
|
||||
@*) completions=$(eval TODOTXT_VERBOSE=0 $_todo_sh command listcon)
|
||||
COMPREPLY=( $( compgen -W "$completions" -- $cur ))
|
||||
[ ${#COMPREPLY[@]} -gt 0 ] && return 0
|
||||
completions=$(eval 'TODOTXT_VERBOSE=0 TODOTXT_SOURCEVAR=\$DONE_FILE' $_todo_sh command listcon)
|
||||
;;
|
||||
*) if [[ "$cur" =~ ^[0-9]+$ ]]; then
|
||||
local todo=$( \
|
||||
eval TODOTXT_VERBOSE=0 $_todo_sh '-@ -+ -p -x command ls "^ *${cur} "' | \
|
||||
sed -e 's/^ *[0-9]\{1,\} //' -e 's/^\((.) \)\{0,1\}[0-9]\{2,4\}-[0-9]\{2\}-[0-9]\{2\} /\1/' \
|
||||
-e 's/^\([xX] \)\([0-9]\{2,4\}-[0-9]\{2\}-[0-9]\{2\} \)\{1,2\}/\1/' \
|
||||
-e 's/[[:space:]]*$//' \
|
||||
-e '1q' \
|
||||
)
|
||||
[ "$todo" ] && COMPREPLY[0]="$cur # $todo"
|
||||
return 0
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
COMPREPLY=( $( compgen -W "$completions" -- $cur ))
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -F _todo todo.sh
|
||||
complete -F _todo t
|
||||
_log_error 'Bash completion for "todo.txt-cli" is now deprecated, as it used code with incompatible license.
|
||||
Please disable this completion and use the instructions from "todo.txt-cli" developers instead.'
|
||||
|
||||
@@ -1,51 +1,7 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
# vault-bash-completion
|
||||
#
|
||||
# This adds bash completions for [HashiCorp Vault](https://www.vaultproject.io/)
|
||||
#
|
||||
# see https://github.com/iljaweis/vault-bash-completion
|
||||
# ---------------------------------------------------------------------------
|
||||
#!/usr/bin/env bash
|
||||
cite "about-completion"
|
||||
about-completion "vault completion"
|
||||
|
||||
function _vault_mounts() {
|
||||
(
|
||||
set -euo pipefail
|
||||
if ! vault mounts 2> /dev/null | awk 'NR > 1 {print $1}'; then
|
||||
echo "secret"
|
||||
if _binary_exists vault; then
|
||||
complete -C vault vault
|
||||
fi
|
||||
)
|
||||
}
|
||||
|
||||
function _vault() {
|
||||
local VAULT_COMMANDS=$(vault 2>&1 | egrep '^ +' | awk '{print $1}')
|
||||
|
||||
local cur
|
||||
local prev
|
||||
|
||||
if [ $COMP_CWORD -gt 0 ]; then
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
fi
|
||||
|
||||
local line=${COMP_LINE}
|
||||
|
||||
if [[ $prev =~ ^(policies|policy-write|policy-delete) ]]; then
|
||||
local policies=$(vault policies 2> /dev/null)
|
||||
COMPREPLY=($(compgen -W "$policies" -- $cur))
|
||||
elif [ "$(echo $line | wc -w)" -le 2 ]; then
|
||||
if [[ "$line" =~ ^vault\ (read|write|delete|list)\ $ ]]; then
|
||||
COMPREPLY=($(compgen -W "$(_vault_mounts)" -- ''))
|
||||
else
|
||||
COMPREPLY=($(compgen -W "$VAULT_COMMANDS" -- $cur))
|
||||
fi
|
||||
elif [[ "$line" =~ ^vault\ (read|write|delete|list)\ (.*)$ ]]; then
|
||||
path=${BASH_REMATCH[2]}
|
||||
if [[ "$path" =~ ^([^ ]+)/([^ /]*)$ ]]; then
|
||||
list=$(vault list -format=yaml ${BASH_REMATCH[1]} 2> /dev/null | awk '{ print $2 }')
|
||||
COMPREPLY=($(compgen -W "$list" -P "${BASH_REMATCH[1]}/" -- ${BASH_REMATCH[2]}))
|
||||
else
|
||||
COMPREPLY=($(compgen -W "$(_vault_mounts)" -- $path))
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
complete -o default -o nospace -F _vault vault
|
||||
|
||||
@@ -1,148 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
# bash completion for virsh - main CLI of libvirt
|
||||
|
||||
# This script provides bash completion for virsh,
|
||||
# borrowed from https://github.com/LuyaoHuang/virsh-bash-completion
|
||||
|
||||
|
||||
|
||||
_contain_cmd()
|
||||
{
|
||||
local e f
|
||||
local array1=($1) array2=($2)
|
||||
|
||||
for e in "${array1[@]}"
|
||||
do
|
||||
for f in "${array2[@]}"
|
||||
do
|
||||
if [[ "$e" == "$f" ]] ; then
|
||||
echo $e
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "notfound"
|
||||
return
|
||||
}
|
||||
|
||||
_virsh_list_networks()
|
||||
{
|
||||
local flag_all=$1 flags
|
||||
|
||||
if [ "$flag_all" -eq 1 ]; then
|
||||
flags="--all"
|
||||
else
|
||||
flags="--inactive"
|
||||
fi
|
||||
virsh -q net-list $flags | cut -d\ -f2 | awk '{print $1}'
|
||||
}
|
||||
|
||||
_virsh_list_domains()
|
||||
{
|
||||
local flag_all=$1 flags
|
||||
|
||||
if [ "$flag_all" -eq 1 ]; then
|
||||
flags="--all"
|
||||
else
|
||||
flags="--inactive"
|
||||
fi
|
||||
virsh -q list $flags | cut -d\ -f7 | awk '{print $1}'
|
||||
}
|
||||
|
||||
_virsh_list_pools()
|
||||
{
|
||||
local flag_all=$1 flags
|
||||
|
||||
if [ "$flag_all" -eq 1 ]; then
|
||||
flags="--all"
|
||||
else
|
||||
flags="--inactive"
|
||||
fi
|
||||
virsh -q pool-list $flags | cut -d\ -f2 | awk '{print $1}'
|
||||
}
|
||||
|
||||
_virsh_list_ifaces()
|
||||
{
|
||||
local flag_all=$1 flags
|
||||
|
||||
if [ "$flag_all" -eq 1 ]; then
|
||||
flags="--all"
|
||||
else
|
||||
flags="--inactive"
|
||||
fi
|
||||
virsh -q iface-list $flags | cut -d\ -f2 | awk '{print $1}'
|
||||
}
|
||||
|
||||
_virsh_list_nwfilters()
|
||||
{
|
||||
|
||||
virsh -q nwfilter-list | cut -d\ -f4 | awk '{print $1}'
|
||||
}
|
||||
|
||||
_virsh()
|
||||
{
|
||||
local cur prev cmds doms options nets pools cmds_help
|
||||
local flag_all=1 array ret a b ifaces nwfilters files
|
||||
|
||||
# not must use bash-completion now :)
|
||||
# _init_completion -s || return
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
cmds=$( echo "$(virsh -h| grep '^ ' | cut -d\ -f5)" \
|
||||
"$(virsh -h| grep '\--' | cut -d\ -f7 | cut -d= -f1)")
|
||||
cmds_help=$(virsh help| grep '^ ' | cut -d\ -f5)
|
||||
case "$prev" in
|
||||
--domain)
|
||||
doms=$(_virsh_list_domains "$flag_all")
|
||||
COMPREPLY=( $(compgen -W "$doms" -- "$cur") )
|
||||
return 0
|
||||
;;
|
||||
--network)
|
||||
nets=$(_virsh_list_networks "$flag_all")
|
||||
COMPREPLY=( $(compgen -W "$nets" -- "$cur") )
|
||||
return 0
|
||||
;;
|
||||
--pool)
|
||||
pools=$(_virsh_list_pools "$flag_all")
|
||||
COMPREPLY=( $(compgen -W "$pools" -- "$cur") )
|
||||
return 0
|
||||
;;
|
||||
--interface)
|
||||
ifaces=$(_virsh_list_ifaces "$flag_all")
|
||||
COMPREPLY=( $(compgen -W "$ifaces" -- "$cur") )
|
||||
return 0
|
||||
;;
|
||||
--nwfilter)
|
||||
nwfilters=$(_virsh_list_nwfilters)
|
||||
COMPREPLY=( $(compgen -W "$nwfilters" -- "$cur") )
|
||||
return 0
|
||||
;;
|
||||
--file|--xml)
|
||||
files=$(ls)
|
||||
COMPREPLY=( $(compgen -W "$files" -- "$cur") )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
array=$(IFS=$'\n'; echo "${COMP_WORDS[*]}")
|
||||
ret=$(_contain_cmd "$array" "$cmds_help")
|
||||
|
||||
if [[ "$ret" != "notfound" && "$ret" != "$cur" ]]; then
|
||||
a=$(virsh help "$ret" |grep '^ --'|cut -d\ -f5)
|
||||
b=$(virsh help "$ret" |grep '^ \[--'|cut -d\ -f5|cut -d[ -f2|cut -d] -f1)
|
||||
options=$( echo $a $b )
|
||||
COMPREPLY=( $(compgen -W "$options" -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
case "$cur" in
|
||||
*)
|
||||
COMPREPLY=( $(compgen -W "$cmds" -- "$cur") )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
} &&
|
||||
complete -o default -F _virsh virsh
|
||||
_log_error 'Bash completion for "virsh" is now deprecated, as it used code with incompatible license.
|
||||
Please disable this completion and use the instructions from "virsh" developers instead.'
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Bash-it
|
||||

|
||||
[](https://gitter.im/Bash-it/bash-it?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||

|
||||
[](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:)
|
||||
@@ -11,8 +12,9 @@ Bash-it provides a solid framework for using, developing and maintaining shell s
|
||||
If you're using the _Bourne Again Shell_ (Bash) regularly and have been looking for an easy way on how to keep all of these nice little scripts and aliases under control, then Bash-it is for you!
|
||||
Stop polluting your `~/bin` directory and your `.bashrc` file, fork/clone Bash-it and start hacking away.
|
||||
|
||||
- [Main Page](https://bash-it.readthedocs.io/en/latest)
|
||||
- [Contributing](#contributing)
|
||||
- [Installation](https://bash-it.readthedocs.io/en/latest/installation)
|
||||
- [Installation](#installation)
|
||||
- [Install Options](https://bash-it.readthedocs.io/en/latest/installation/#install-options)
|
||||
- [via Docker](https://bash-it.readthedocs.io/en/latest/installation/#install-using-docker)
|
||||
- [Updating](https://bash-it.readthedocs.io/en/latest/installation/#updating)
|
||||
@@ -31,6 +33,17 @@ Stop polluting your `~/bin` directory and your `.bashrc` file, fork/clone Bash-i
|
||||
- [Help Out](https://bash-it.readthedocs.io/en/latest/#help-out)
|
||||
- [Contributors](#contributors)
|
||||
|
||||
## Installation
|
||||
|
||||
1) Check out a clone of this repo to a location of your choice, such as
|
||||
``git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it``
|
||||
2) Run ``~/.bash_it/install.sh``
|
||||
|
||||
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/).
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
Please take a look at the [Contribution Guidelines](https://bash-it.readthedocs.io/en/latest/contributing) before reporting a bug or providing a new feature.
|
||||
|
||||
@@ -31,7 +31,8 @@ release = ''
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx_rtd_theme'
|
||||
'sphinx_rtd_theme',
|
||||
'sphinxemoji.sphinxemoji',
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
|
||||
@@ -39,7 +39,7 @@ Code Style
|
||||
|
||||
|
||||
* When adding new files, be sure to add them into `clean_files.txt`, which is a growing list of linted files in the project.
|
||||
* When changing existing files, consider also adding them into `clean_files.txt` and fixing the linting errors that arise.
|
||||
* When changing existing files, consider also adding them into `clean_files.txt` and fixing the linting errors that arise. See :ref:`linting_your_changes` for more information.
|
||||
* Indentation is using tabs, not spaces. Most of the code is indented with 2 spaces, some with 4 spaced tabs. Please try to stick to tabs.
|
||||
If you're using an editor that supports `EditorConfig <http://EditorConfig.org>`_\ , the editor should automatically use the settings defined in Bash-it's `.editorconfig file <.editorconfig>`_.
|
||||
* When creating new functions, please use a dash ("-") to separate the words of the function's name, e.g. ``my-new-function``.
|
||||
@@ -104,7 +104,7 @@ Themes
|
||||
|
||||
|
||||
* When adding a new theme, please include a screenshot and a short description about what makes this theme unique in the Pull Request's description field.
|
||||
Please do not add theme screenshots to the repo itself, as they will add unnecessary bloat to the repo.
|
||||
Please do not add theme screenshots to the main PR itself, as they will add unnecessary bloat to the main branch in the repo.
|
||||
The project's docs has a `Themes page <https://github.com/Bash-it/bash-it/blob/master/docs/themes-list/index.rst>`_ where you should add a screenshot, see how :ref:`here<add_screenshot>`.
|
||||
* Ideally, you should add a ``<theme_name>.rst`` file describing the theme and its configuration options to ``docs/themes-list`` folder.
|
||||
|
||||
|
||||
@@ -92,3 +92,21 @@ This file configures the behavior of the a pre-commit hook based on `the Pre-Com
|
||||
installing it (with pip, brew or other tools) then run ``pre-commit install`` in the repo's root to activate the hook.
|
||||
For the full use of the tool, you may need to install also other third-party tools, such as
|
||||
`shellcheck <https://github.com/koalaman/shellcheck/>`_ and `shfmt <https://github.com/mvdan/sh>`_.
|
||||
|
||||
|
||||
.. _linting_your_changes:
|
||||
|
||||
Linting Your Changes
|
||||
--------------------
|
||||
|
||||
In order to properly lint your changes, you should use our linting script,
|
||||
by simply running ``./lint_clean_files.sh``. This script iterates over all marked-as-clean
|
||||
files, and runs the pre-commit hook on them.
|
||||
|
||||
Please note that most of the files in the project are currently not linted,
|
||||
as we want to make the linting process easier.
|
||||
In order to add your changed/added files to the linting process,
|
||||
please add your files to ``clean_files.txt``. This way ``lint_clean_files.sh``
|
||||
will know to pick them up and lint them.
|
||||
|
||||
Thank you for helping clean up Bash-it, and making it a nicer and better project |:heart:|
|
||||
|
||||
13
docs/help_screens.rst
Normal file
13
docs/help_screens.rst
Normal file
@@ -0,0 +1,13 @@
|
||||
.. _help_screens:
|
||||
|
||||
Help Screens
|
||||
^^^^^^^^^^^^
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
bash-it show aliases # shows installed and available aliases
|
||||
bash-it show completions # shows installed and available completions
|
||||
bash-it show plugins # shows installed and available plugins
|
||||
bash-it help aliases # shows help for installed aliases
|
||||
bash-it help completions # shows help for installed completions
|
||||
bash-it help plugins # shows help for installed plugins
|
||||
@@ -3,74 +3,8 @@
|
||||
Misc
|
||||
----
|
||||
|
||||
Help Screens
|
||||
^^^^^^^^^^^^
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
bash-it show aliases # shows installed and available aliases
|
||||
bash-it show completions # shows installed and available completions
|
||||
bash-it show plugins # shows installed and available plugins
|
||||
bash-it help aliases # shows help for installed aliases
|
||||
bash-it help completions # shows help for installed completions
|
||||
bash-it help plugins # shows help for installed plugins
|
||||
|
||||
Pass function renamed to passgen
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The Bash-it ``pass`` function has been renamed to ``passgen`` in order to avoid a naming conflict with the `pass password manager <https://www.passwordstore.org/>`_.
|
||||
In order to minimize the impact on users of the legacy Bash-it ``pass`` function, Bash-it will create the alias ``pass`` that calls the new ``passgen`` function if the ``pass`` password manager command is not found on the ``PATH`` (default behavior).
|
||||
|
||||
This behavior can be overridden with the ``BASH_IT_LEGACY_PASS`` flag as follows:
|
||||
|
||||
Set ``BASH_IT_LEGACY_PASS`` to 'true' to force Bash-it to always **create** the ``pass`` alias to ``passgen``\ :
|
||||
|
||||
|
||||
* ``export BASH_IT_LEGACY_PASS=true``
|
||||
|
||||
Unset ``BASH_IT_LEGACY_PASS`` to have Bash-it **return to default behavior**\ :
|
||||
|
||||
|
||||
* ``unset BASH_IT_LEGACY_PASS``
|
||||
|
||||
Proxy Support
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
If you are working in a corporate environment where you have to go through a proxy server for internet access,
|
||||
then you know how painful it is to configure the OS proxy variables in the shell,
|
||||
especially if you are switching between environments, e.g. office (with proxy) and home (without proxy).
|
||||
|
||||
The Bash shell (and many shell tools) use the following variables to define the proxy to use:
|
||||
|
||||
|
||||
* ``HTTP_PROXY`` (and ``http_proxy``\ ): Defines the proxy server for HTTP requests
|
||||
* ``HTTPS_PROXY`` (and ``https_proxy``\ ): Defines the proxy server for HTTPS requests
|
||||
* ``ALL_PROXY`` (and ``all_proxy``\ ): Used by some tools for the same purpose as above
|
||||
* ``NO_PROXY`` (and ``no_proxy``\ ): Comma-separated list of hostnames that don't have to go through the proxy
|
||||
|
||||
Bash-it's ``proxy`` plugin allows to enable and disable these variables with a simple command.
|
||||
To start using the ``proxy`` plugin, run the following:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
bash-it enable plugin proxy
|
||||
|
||||
Bash-it also provides support for enabling/disabling proxy settings for various shell tools.
|
||||
The following backends are currently supported (in addition to the shell's environment variables): Git, SVN, npm, ssh.
|
||||
The ``proxy`` plugin changes the configuration files of these tools to enable or disable the proxy settings.
|
||||
|
||||
Bash-it uses the following variables to set the shell's proxy settings when you call ``enable-proxy``.
|
||||
These variables are best defined in a custom script in Bash-it's custom script folder (\ ``$BASH_IT/custom``\ ), e.g. ``$BASH_IT/custom/proxy.env.bash``
|
||||
|
||||
|
||||
* ``BASH_IT_HTTP_PROXY`` and `BASH_IT_HTTPS_PROXY`: Define the proxy URL to be used, e.g. 'http://localhost:1234'
|
||||
* ``BASH_IT_NO_PROXY``\ : A comma-separated list of proxy exclusions, e.g. ``127.0.0.1,localhost``
|
||||
|
||||
Once you have defined these variables (and have run ``reload`` to load the changes), you can use the following commands to enable or disable the proxy settings in your current shell:
|
||||
|
||||
|
||||
* ``enable-proxy``\ : This sets the shell's proxy environment variables and configures proxy support in your SVN, npm, and SSH configuration files.
|
||||
* ``disable-proxy``\ : This unsets the shell's proxy environment variables and disables proxy support in your SVN, npm, and SSH configuration files.
|
||||
|
||||
There are many more proxy commands, e.g. for changing the local Git project's proxy settings.
|
||||
Run ``glossary proxy`` to show the available proxy functions with a short description.
|
||||
help_screens
|
||||
proxy_support
|
||||
|
||||
43
docs/proxy_support.rst
Normal file
43
docs/proxy_support.rst
Normal file
@@ -0,0 +1,43 @@
|
||||
.. _proxy_support:
|
||||
|
||||
Proxy Support
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
If you are working in a corporate environment where you have to go through a proxy server for internet access,
|
||||
then you know how painful it is to configure the OS proxy variables in the shell,
|
||||
especially if you are switching between environments, e.g. office (with proxy) and home (without proxy).
|
||||
|
||||
The Bash shell (and many shell tools) use the following variables to define the proxy to use:
|
||||
|
||||
|
||||
* ``HTTP_PROXY`` (and ``http_proxy``\ ): Defines the proxy server for HTTP requests
|
||||
* ``HTTPS_PROXY`` (and ``https_proxy``\ ): Defines the proxy server for HTTPS requests
|
||||
* ``ALL_PROXY`` (and ``all_proxy``\ ): Used by some tools for the same purpose as above
|
||||
* ``NO_PROXY`` (and ``no_proxy``\ ): Comma-separated list of hostnames that don't have to go through the proxy
|
||||
|
||||
Bash-it's ``proxy`` plugin allows to enable and disable these variables with a simple command.
|
||||
To start using the ``proxy`` plugin, run the following:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
bash-it enable plugin proxy
|
||||
|
||||
Bash-it also provides support for enabling/disabling proxy settings for various shell tools.
|
||||
The following backends are currently supported (in addition to the shell's environment variables): Git, SVN, npm, ssh.
|
||||
The ``proxy`` plugin changes the configuration files of these tools to enable or disable the proxy settings.
|
||||
|
||||
Bash-it uses the following variables to set the shell's proxy settings when you call ``enable-proxy``.
|
||||
These variables are best defined in a custom script in Bash-it's custom script folder (\ ``$BASH_IT/custom``\ ), e.g. ``$BASH_IT/custom/proxy.env.bash``
|
||||
|
||||
|
||||
* ``BASH_IT_HTTP_PROXY`` and `BASH_IT_HTTPS_PROXY`: Define the proxy URL to be used, e.g. 'http://localhost:1234'
|
||||
* ``BASH_IT_NO_PROXY``\ : A comma-separated list of proxy exclusions, e.g. ``127.0.0.1,localhost``
|
||||
|
||||
Once you have defined these variables (and have run ``reload`` to load the changes), you can use the following commands to enable or disable the proxy settings in your current shell:
|
||||
|
||||
|
||||
* ``enable-proxy``\ : This sets the shell's proxy environment variables and configures proxy support in your SVN, npm, and SSH configuration files.
|
||||
* ``disable-proxy``\ : This unsets the shell's proxy environment variables and disables proxy support in your SVN, npm, and SSH configuration files.
|
||||
|
||||
There are many more proxy commands, e.g. for changing the local Git project's proxy settings.
|
||||
Run ``glossary proxy`` to show the available proxy functions with a short description.
|
||||
@@ -1,2 +1,3 @@
|
||||
sphinx==3.2.1
|
||||
sphinx-rtd-theme==0.5.0
|
||||
sphinxemoji==0.1.8
|
||||
|
||||
@@ -38,6 +38,7 @@ Default theme glyphs
|
||||
BARBUK_SVN_CHAR='⑆ '
|
||||
BARBUK_EXIT_CODE_ICON=' '
|
||||
BARBUK_PYTHON_VENV_CHAR=' '
|
||||
BARBUK_COMMAND_DURATION_ICON=' '
|
||||
|
||||
Customize glyphs
|
||||
^^^^^^^^^^^^^^^^
|
||||
@@ -92,6 +93,11 @@ Please refer to the following documentation for more information:
|
||||
EOF
|
||||
chmod 400 /etc/sudoers.d/keepenv
|
||||
|
||||
Command duration
|
||||
----------------
|
||||
|
||||
See :ref:`Command duration <command_duration>`.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
@@ -122,3 +128,11 @@ Python venv
|
||||
.. code-block:: bash
|
||||
|
||||
flask ~/test on master ✓ ❯
|
||||
|
||||
Command duration
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# sleep 3s
|
||||
user@hostname in ~/bash-it on master ✓ 3.2s ❯
|
||||
|
||||
@@ -37,6 +37,29 @@ See :ref:`here <list_of_themes>`.
|
||||
Theme Switches & Variables
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. _command_duration:
|
||||
|
||||
Command duration
|
||||
================
|
||||
|
||||
Prints last command duration
|
||||
|
||||
Usage
|
||||
#####
|
||||
|
||||
Command duration can be enabled by exporting ``BASH_IT_COMMAND_DURATION``:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
export BASH_IT_COMMAND_DURATION=true
|
||||
|
||||
The default configuration display last command duration for command lasting one second or more.
|
||||
You can customize the minimum time in seconds before command duration is displayed in your ``.bashrc``:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
export COMMAND_DURATION_MIN_SECONDS=5
|
||||
|
||||
Clock Related
|
||||
=============
|
||||
|
||||
|
||||
@@ -171,6 +171,8 @@ elif [[ $silent ]] && ! [[ $no_modify_config ]]; then
|
||||
backup_new
|
||||
fi
|
||||
|
||||
# Disable auto-reload in case its enabled
|
||||
export BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE=''
|
||||
# Load dependencies for enabling components
|
||||
source "$BASH_IT/lib/composure.bash"
|
||||
source "$BASH_IT/lib/utilities.bash"
|
||||
|
||||
@@ -346,6 +346,11 @@ _bash-it-version() {
|
||||
|
||||
BASH_IT_GIT_REMOTE=$(git remote get-url $BASH_IT_REMOTE)
|
||||
BASH_IT_GIT_URL=${BASH_IT_GIT_REMOTE%.git}
|
||||
if [[ "$BASH_IT_GIT_URL" == *"git@"* ]]; then
|
||||
# Fix URL in case it is ssh based URL
|
||||
BASH_IT_GIT_URL=${BASH_IT_GIT_URL/://}
|
||||
BASH_IT_GIT_URL=${BASH_IT_GIT_URL/git@/https://}
|
||||
fi
|
||||
|
||||
current_tag=$(git describe --exact-match --tags 2> /dev/null)
|
||||
|
||||
|
||||
@@ -91,5 +91,5 @@ function alias_completion {
|
||||
echo "$new_completion" >> "$tmp_file"
|
||||
fi
|
||||
done < <(alias -p | sed -Ene "s/$alias_regex/\2 '\3' '\4'/p")
|
||||
source "$tmp_file" && rm -f "$tmp_file"
|
||||
source "$tmp_file" && command rm -f "$tmp_file"
|
||||
}; alias_completion
|
||||
|
||||
@@ -11,12 +11,15 @@ function _set-prefix-based-on-path()
|
||||
|
||||
if [ "$1" != "skip" ] && [ -d "./enabled" ]; then
|
||||
_bash_it_config_type=""
|
||||
if [[ "${1}" =~ ^(alias|completion|plugin)$ ]]; then
|
||||
|
||||
case $1 in
|
||||
alias|completion|plugin)
|
||||
_bash_it_config_type=$1
|
||||
_log_debug "Loading enabled $1 components..."
|
||||
else
|
||||
_log_debug "Loading all enabled components..."
|
||||
fi
|
||||
_log_debug "Loading enabled $1 components..." ;;
|
||||
*|'')
|
||||
_log_debug "Loading all enabled components..." ;;
|
||||
esac
|
||||
|
||||
for _bash_it_config_file in $(sort <(compgen -G "./enabled/*${_bash_it_config_type}.bash")); do
|
||||
if [ -e "${_bash_it_config_file}" ]; then
|
||||
_set-prefix-based-on-path "${_bash_it_config_file}"
|
||||
@@ -29,8 +32,9 @@ if [ "$1" != "skip" ] && [ -d "./enabled" ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -z "${2}" ] && [[ "${2}" =~ ^(aliases|completion|plugins)$ ]] && [ -d "${2}/enabled" ]; then
|
||||
if [ -n "${2}" ] && [ -d "${2}/enabled" ]; then
|
||||
case $2 in
|
||||
aliases|completion|plugins)
|
||||
_log_warning "Using legacy enabling for $2, please update your bash-it version and migrate"
|
||||
for _bash_it_config_file in $(sort <(compgen -G "./${2}/enabled/*.bash")); do
|
||||
if [ -e "$_bash_it_config_file" ]; then
|
||||
@@ -41,7 +45,8 @@ if [ ! -z "${2}" ] && [[ "${2}" =~ ^(aliases|completion|plugins)$ ]] && [ -d "${
|
||||
else
|
||||
echo "Unable to locate ${_bash_it_config_file}" > /dev/stderr
|
||||
fi
|
||||
done
|
||||
done ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
unset _bash_it_config_file
|
||||
|
||||
@@ -51,6 +51,13 @@ export SCM_CHECK=true
|
||||
# Will otherwise fall back on $USER.
|
||||
#export SHORT_USER=${USER:0:8}
|
||||
|
||||
# If your theme use command duration, uncomment this to
|
||||
# enable display of last command duration.
|
||||
#export BASH_IT_COMMAND_DURATION=true
|
||||
# You can choose the minimum time in seconds before
|
||||
# command duration is displayed.
|
||||
#export COMMAND_DURATION_MIN_SECONDS=1
|
||||
|
||||
# Set Xterm/screen/Tmux title with shortened command and directory.
|
||||
# Uncomment this to set.
|
||||
#export SHORT_TERM_LINE=true
|
||||
|
||||
@@ -7,7 +7,7 @@ load ../../lib/helpers
|
||||
|
||||
cite _about _param _example _group _author _version
|
||||
|
||||
load ../../completion/available/git.completion
|
||||
load ../../completion/available/capistrano.completion
|
||||
|
||||
@test "alias-completion: See that aliases with double quotes and brackets do not break the plugin" {
|
||||
alias gtest="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"
|
||||
@@ -22,3 +22,10 @@ load ../../completion/available/git.completion
|
||||
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "alias-completion: See that having aliased rm command does not output unnecessary output" {
|
||||
alias rm='rm -v'
|
||||
load ../../plugins/available/alias-completion.plugin
|
||||
|
||||
refute_output
|
||||
}
|
||||
|
||||
1
themes/barbuk/README.rst
Symbolic link
1
themes/barbuk/README.rst
Symbolic link
@@ -0,0 +1 @@
|
||||
../../docs/themes-list/barbuk.rst
|
||||
@@ -11,6 +11,11 @@ SCM_HG_CHAR=${BARBUK_HG_CHAR:='☿ '}
|
||||
SCM_SVN_CHAR=${BARBUK_SVN_CHAR:='⑆ '}
|
||||
EXIT_CODE_ICON=${BARBUK_EXIT_CODE_ICON:=' '}
|
||||
PYTHON_VENV_CHAR=${BARBUK_PYTHON_VENV_CHAR:=' '}
|
||||
COMMAND_DURATION_ICON=${BARBUK_COMMAND_DURATION_ICON:-"$bold_blue "}
|
||||
|
||||
# Command duration
|
||||
COMMAND_DURATION_MIN_SECONDS=${COMMAND_DURATION_MIN_SECONDS:-1}
|
||||
COMMAND_DURATION_COLOR="$normal"
|
||||
|
||||
# Ssh user and hostname display
|
||||
SSH_INFO=${BARBUK_SSH_INFO:=true}
|
||||
@@ -67,7 +72,9 @@ function _exit-code {
|
||||
}
|
||||
|
||||
function _prompt {
|
||||
local exit_code="$?" wrap_char=' ' dir_color=$green ssh_info='' python_venv='' host
|
||||
local exit_code="$?" wrap_char=' ' dir_color=$green ssh_info='' python_venv='' host command_duration=
|
||||
|
||||
command_duration=$(_command_duration)
|
||||
|
||||
_exit-code exit_code
|
||||
_git-uptream-remote-logo
|
||||
@@ -96,9 +103,8 @@ function _prompt {
|
||||
python_venv="$PYTHON_VENV_CHAR$(basename "${VIRTUAL_ENV}") "
|
||||
fi
|
||||
|
||||
PS1="\\n${ssh_info} ${purple}$(scm_char)${python_venv}${dir_color}\\w${normal}$(scm_prompt_info)${exit_code}"
|
||||
|
||||
[[ ${#PS1} -gt $((COLUMNS*3)) ]] && wrap_char="\\n"
|
||||
PS1="\\n${ssh_info} ${purple}$(scm_char)${python_venv}${dir_color}\\w${normal}$(scm_prompt_info)${command_duration}${exit_code}"
|
||||
[[ ${#PS1} -gt $((COLUMNS*2)) ]] && wrap_char="\\n"
|
||||
PS1="${PS1}${wrap_char}❯${normal} "
|
||||
}
|
||||
|
||||
|
||||
73
themes/command_duration.theme.bash
Normal file
73
themes/command_duration.theme.bash
Normal file
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -z "$BASH_IT_COMMAND_DURATION" ] || [ "$BASH_IT_COMMAND_DURATION" != true ]; then
|
||||
_command_duration() {
|
||||
echo -n
|
||||
}
|
||||
return
|
||||
fi
|
||||
|
||||
# Define tmp dir and file
|
||||
COMMAND_DURATION_TMPDIR="${TMPDIR:-/tmp}"
|
||||
COMMAND_DURATION_FILE="${COMMAND_DURATION_FILE:-$COMMAND_DURATION_TMPDIR/bashit_theme_execution_$BASHPID}"
|
||||
|
||||
COMMAND_DURATION_ICON=${COMMAND_DURATION_ICON:-' '}
|
||||
COMMAND_DURATION_MIN_SECONDS=${COMMAND_DURATION_MIN_SECONDS:-'1'}
|
||||
|
||||
trap _command_duration_delete_temp_file EXIT HUP INT TERM
|
||||
|
||||
_command_duration_delete_temp_file() {
|
||||
if [[ -f "$COMMAND_DURATION_FILE" ]]; then
|
||||
rm -f "$COMMAND_DURATION_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
_command_duration_pre_exec() {
|
||||
date +%s.%1N > "$COMMAND_DURATION_FILE"
|
||||
}
|
||||
|
||||
_command_duration() {
|
||||
local command_duration command_start current_time
|
||||
local minutes seconds deciseconds
|
||||
local command_start_sseconds current_time_seconds command_start_deciseconds current_time_deciseconds
|
||||
current_time=$(date +%s.%1N)
|
||||
|
||||
if [[ -f "$COMMAND_DURATION_FILE" ]]; then
|
||||
command_start=$(< "$COMMAND_DURATION_FILE")
|
||||
command_start_sseconds=${command_start%.*}
|
||||
current_time_seconds=${current_time%.*}
|
||||
|
||||
command_start_deciseconds=$((10#${command_start#*.}))
|
||||
current_time_deciseconds=$((10#${current_time#*.}))
|
||||
|
||||
# seconds
|
||||
command_duration=$(( current_time_seconds - command_start_sseconds ))
|
||||
|
||||
if (( current_time_deciseconds >= command_start_deciseconds )); then
|
||||
deciseconds=$(( (current_time_deciseconds - command_start_deciseconds) ))
|
||||
else
|
||||
((command_duration-=1))
|
||||
deciseconds=$(( 10 - ( (command_start_deciseconds - current_time_deciseconds) ) ))
|
||||
fi
|
||||
command rm "$COMMAND_DURATION_FILE"
|
||||
else
|
||||
command_duration=0
|
||||
fi
|
||||
|
||||
if (( command_duration > 0 )); then
|
||||
minutes=$(( command_duration / 60 ))
|
||||
seconds=$(( command_duration % 60 ))
|
||||
fi
|
||||
|
||||
if (( minutes > 0 )); then
|
||||
printf "%s%s%dm %ds" "$COMMAND_DURATION_ICON" "$COMMAND_DURATION_COLOR" "$minutes" "$seconds"
|
||||
elif (( seconds >= COMMAND_DURATION_MIN_SECONDS )); then
|
||||
printf "%s%s%d.%01ds" "$COMMAND_DURATION_ICON" "$COMMAND_DURATION_COLOR" "$seconds" "$deciseconds"
|
||||
fi
|
||||
}
|
||||
|
||||
preexec() (
|
||||
_command_duration_pre_exec
|
||||
)
|
||||
|
||||
preexec_install
|
||||
@@ -1,3 +1,10 @@
|
||||
# The "modern-t" theme is a "modern" theme variant with support
|
||||
# for "t", the minimalist python todo list utility by Steve Losh.
|
||||
# Get and install "t" at https://github.com/sjl/t#installing-t
|
||||
#
|
||||
# Warning: The Bash-it plugin "todo.plugin" breaks the "t"
|
||||
# prompt integration, please disable it while using this theme.
|
||||
|
||||
SCM_THEME_PROMPT_PREFIX=""
|
||||
SCM_THEME_PROMPT_SUFFIX=""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user