55 Commits

Author SHA1 Message Date
Noah Gorny
5487963fa7 Merge pull request #1752 from Bash-it/add-license-1
Add LICENSE
2020-12-29 22:41:34 +02:00
Noah Gorny
0565c3aa8e Merge pull request #1741 from NoahGorny/licensing
Clean up embedded licensing issues
2020-12-29 22:40:58 +02:00
Noah Gorny
8e73b538ea Deprecate homesick completion as it is unlicensed 2020-12-29 21:49:47 +02:00
Noah Gorny
012552d8b7 Deprecate drush completion as it is GPLv2 2020-12-29 21:49:47 +02:00
Noah Gorny
a369cc7c0a Deprecate virsh completion as it is GPLv2 2020-12-29 21:49:47 +02:00
Noah Gorny
cd44880c15 Deprecate todo completion scripts as it is GPLv3 2020-12-29 21:49:47 +02:00
Noah Gorny
292da7ef77 Add license notice to jboss7 completion 2020-12-29 21:49:47 +02:00
Noah Gorny
59439c2f62 Add license notice to docker-machine/compose completion 2020-12-29 21:49:47 +02:00
Noah Gorny
8cc7327c0b Add license notice to salt completion 2020-12-29 21:49:47 +02:00
Noah Gorny
5188b3b0c0 Add license notice to gulp and grunt completion 2020-12-29 21:49:47 +02:00
Noah Gorny
334005ead3 Clean up vault completion and add to clean_files.txt 2020-12-29 21:49:42 +02:00
Noah Gorny
6eb5802080 Add license notice to hub completion 2020-12-29 21:49:10 +02:00
Noah Gorny
3ba1a14eb9 Remove broken link from tmux completion 2020-12-29 21:49:10 +02:00
Noah Gorny
f4f229573d Clean up packer completion and add to clean_files.txt 2020-12-29 21:49:10 +02:00
Noah Gorny
6a69931240 Add license to invoke completion 2020-12-29 21:49:10 +02:00
Noah Gorny
f221cdca9e Clarify license on bundler completion 2020-12-29 21:49:10 +02:00
Noah Gorny
17211b0b1a Add license to apm completion script 2020-12-29 21:49:10 +02:00
Noah Gorny
2329b4395b Add license notice to gradle completion 2020-12-29 21:49:10 +02:00
Noah Gorny
3a2ccd3792 Add license notice to django completion 2020-12-29 21:49:10 +02:00
Noah Gorny
1d4b325ce9 Merge pull request #1734 from georgettica/patch-2
feat(vim-alias): add full screen help
2020-12-28 21:39:43 +02:00
Noah Gorny
a1da0087a1 Merge pull request #1748 from NoahGorny/fix-git-url-in-bashit-version
version: Fix url in case it is ssh based one
2020-12-28 21:35:53 +02:00
Ron Green
d6e2b04708 fix(vim-aliases): join '$VIM' statements 2020-12-28 10:58:09 +02:00
Noah Gorny
908fed9f50 Merge pull request #1738 from NoahGorny/fix-1354
Use command rm in alias_completion
2020-12-27 19:11:11 +02:00
BarbUk
13e795c995 add command time duration plugin (#1683) 2020-12-27 18:48:17 +02:00
Ron Green
e94b9420ac fix(vim-aliases): make alias dependant on envvar 2020-12-27 18:05:11 +02:00
Russell
b119540ce7 Add comment to install "t" and disable "todo.plugin" (#1742)
This commit is intended to help new uses of the
modern-t theme get it set up properly
and avoid the "todo.plugin" breaking it

Please see the following issues for details.
https://github.com/Bash-it/bash-it/issues/1693
https://github.com/Bash-it/bash-it/issues/1374

Co-authored-by: Russell Adams <russell.adams@avast.com>
2020-12-27 17:24:52 +02:00
Noah Gorny
d2a5524556 Add LICENSE
Woohoo!  
What a time to be alive 😄
2020-12-27 17:17:51 +02:00
Terminal for Life
921ea9ac76 Optimizations to reloader.bash (#1749)
* Optimized statement with REGEX by using `case`

REGEX is a great feature of BASH, but in this case it was energy
needlessly spent. A `case` statement suffices. Bring in REGEX when
you're going to make good use of it, otherwise it's just going to bog
down your code.

I also wanted to strip the ` || exit 1` on the last line, but I wasn't
sure if this file is meant to be sourced or not; if not, then exiting
like that is redundant because it will already exit with whichever
status the last command provides, unless `popd` specifically offers
unhelpful or no exit statuses.

* Optimize as before but with 2nd REGEX instance

This time is much like the last commit, so I won't repeat, but I will
say that you're using a double- or even triple-negative, which
obfuscates your goal. Where you were doing...

[ ! -n VAR ] &&

You were basically saying this convolution:

If it's true that it's not true that VAR is not empty.

Very confusing. Instead, I've opted for:

If it's true that Var is empty.

Makes immediate sense and is easier to parse, visually speaking.
2020-12-27 17:14:50 +02:00
Noah Gorny
b19c2b969f test: Change alias-completion completion file to capistrano 2020-12-27 17:12:22 +02:00
Ron Green
d74cc615be feat(lint): lint vim.aliases 2020-12-23 10:19:06 +02:00
Noah Gorny
5aa2612ff1 Merge pull request #1746 from NoahGorny/add-lint-clean-files-instructions
add lint clean files instructions
2020-12-21 00:31:22 +02:00
Noah Gorny
6914a2345a version: Fix url in case it is ssh based one 2020-12-21 00:30:56 +02:00
Noah Gorny
8bc83b2d48 docs: Add lint_clean_files instructions 2020-12-20 23:29:01 +02:00
Noah Gorny
9ca6841e20 docs: Add sphinx-emoji support 2020-12-20 23:29:01 +02:00
Noah Gorny
e1372dd5bd Merge pull request #1747 from NoahGorny/add-easy-installation-docs
docs: Add simple installation instructions to readme
2020-12-18 17:15:33 +02:00
Noah Gorny
7edc26f408 Merge pull request #1727 from NoahGorny/add-issue-and-pr-templates
github: Add pr template
2020-12-18 11:48:02 +02:00
Noah Gorny
d00c478ded Merge pull request #1740 from Bash-it/NoahGorny-patch-2
Add bug+feature issue templates
2020-12-18 11:47:11 +02:00
Noah Gorny
13be44ab19 Merge pull request #1735 from NoahGorny/docs-more-improvements
docs more improvements
2020-12-17 19:10:15 +02:00
Noah Gorny
181863af1d docs: Add simple installation instructions to readme
This will help newcomers, and not confuse them by redirecting them to
another site instantly.
2020-12-17 01:42:25 +02:00
Noah Gorny
859038e58f Allow trailing spaces in md/rst files 2020-12-17 01:42:25 +02:00
Noah Gorny
501b1ab3b5 Merge pull request #1730 from NoahGorny/fix-1037
Disable auto-reload in install.sh
2020-12-16 20:08:06 +02:00
Noah Gorny
89787cf261 github: Add pr template 2020-12-16 19:46:23 +02:00
Noah Gorny
2b4a81f39c Add bug+feature issue templates 2020-12-16 19:12:54 +02:00
Ron Green
5eb023cf51 Update vim.aliases.bash 2020-12-15 22:46:47 +02:00
Noah Gorny
6008006783 Merge pull request #1736 from NoahGorny/add-irc-badge
readme: Change join chat to IRC from gitter
2020-12-14 03:41:46 +02:00
Noah Gorny
f10834275f Merge pull request #1737 from NoahGorny/add-main-page-to-readme
docs: Add readthedocs main page to readme
2020-12-14 03:40:54 +02:00
Noah Gorny
1c05d71819 alias-completion: Use 'command rm' instead of rm to avoid aliases 2020-12-14 01:25:58 +02:00
Noah Gorny
f5753e4416 test: Add test for aliases rm for alias_completion 2020-12-14 01:21:00 +02:00
Noah Gorny
654a49cbd8 docs: Add readthedocs main page to readme 2020-12-14 00:49:26 +02:00
Noah Gorny
b5fecb3eb3 readme: Add docs status badge 2020-12-14 00:47:32 +02:00
Noah Gorny
0d7f145ef4 readme: Change join chat to IRC from gitter 2020-12-14 00:28:57 +02:00
Noah Gorny
dca563e606 docs: misc: Move help_screens and proxy_support into seperate pages 2020-12-14 00:14:23 +02:00
Noah Gorny
cf2df9e896 docs: Restructure sentence about adding screenshots 2020-12-14 00:05:17 +02:00
Ron Green
a1760af43b feat(vim-alias): add full screen help 2020-12-12 12:51:16 +02:00
Noah Gorny
e873252227 Disable auto-reload in install.sh 2020-12-06 23:55:25 +02:00
49 changed files with 701 additions and 645 deletions

View File

@@ -9,7 +9,7 @@ charset = utf-8
trim_trailing_whitespace = true trim_trailing_whitespace = true
insert_final_newline = true insert_final_newline = true
[*.md] [*.{md,rst}]
trim_trailing_whitespace = false trim_trailing_whitespace = false
[.git*] [.git*]

4
.gitattributes vendored
View File

@@ -1,5 +1,9 @@
*.sh text eol=lf *.sh text eol=lf
*.bash text eol=lf *.bash text eol=lf
# Docs allow trailing whitespaces
*.md whitespace=-blank-at-eol
*.rst whitespace=-blank-at-eol
# Windows files # Windows files
*.bat text eol=crlf *.bat text eol=crlf

46
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View 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
```

View 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
View 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.

View File

@@ -9,6 +9,7 @@ repos:
rev: v2.3.0 rev: v2.3.0
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
exclude: ".(md|rst)$"
- id: end-of-file-fixer - id: end-of-file-fixer
- id: check-merge-conflict - id: check-merge-conflict
- id: mixed-line-ending - id: mixed-line-ending

21
LICENSE Normal file
View 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.

View File

@@ -5,15 +5,20 @@ VIM=$(command -v vim)
GVIM=$(command -v gvim) GVIM=$(command -v gvim)
MVIM=$(command -v mvim) 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 # open vim in new tab is taken from
# http://stackoverflow.com/questions/936501/let-gvim-always-run-a-single-instancek # http://stackoverflow.com/questions/936501/let-gvim-always-run-a-single-instancek
case $OSTYPE in case $OSTYPE in
darwin*) darwin*)
[[ -n $MVIM ]] && function mvimt { command mvim --remote-tab-silent "$@" || command mvim "$@"; } [[ -n $MVIM ]] && function mvimt { command mvim --remote-tab-silent "$@" || command mvim "$@"; }
;; ;;
*) *)
[[ -n $GVIM ]] && function gvimt { command gvim --remote-tab-silent "$@" || command gvim "$@"; } [[ -n $GVIM ]] && function gvimt { command gvim --remote-tab-silent "$@" || command gvim "$@"; }
;; ;;
esac esac

View File

@@ -74,6 +74,9 @@ if [[ ! -z "${BASH_IT_THEME}" ]]; then
BASH_IT_LOG_PREFIX="themes: p4helpers: " BASH_IT_LOG_PREFIX="themes: p4helpers: "
# shellcheck source=./themes/p4helpers.theme.bash # shellcheck source=./themes/p4helpers.theme.bash
source "${BASH_IT}/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: " BASH_IT_LOG_PREFIX="themes: base: "
# shellcheck source=./themes/base.theme.bash # shellcheck source=./themes/base.theme.bash
source "${BASH_IT}/themes/base.theme.bash" source "${BASH_IT}/themes/base.theme.bash"

View File

@@ -32,5 +32,10 @@ themes/powerline
# #
completion/available/cargo.completion.bash completion/available/cargo.completion.bash
completion/available/knife.completion.bash completion/available/knife.completion.bash
completion/available/packer.completion.bash
completion/available/pipx.completion.bash completion/available/pipx.completion.bash
completion/available/rustup.completion.bash completion/available/rustup.completion.bash
completion/available/vault.completion.bash
# aliases
aliases/available/vim.aliases.bash

View File

@@ -1,6 +1,27 @@
#!/usr/bin/env bash #!/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 # repo: https://github.com/vigo/apm-bash-completion
__apm(){ __apm(){

View File

@@ -1,9 +1,28 @@
#! bash #! bash
# bash completion for the `bundle` command. # bash completion for the `bundle` command.
# #
# Copyright (c) 2011-2017 Daniel Luz <dev at mernen dot com>. # Copyright (c) 2008 Daniel Luz
# Distributed under the MIT license.
# http://mernen.com/projects/completion-ruby # 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: # To use, source this file on bash:
# . completion-bundle # . completion-bundle

View File

@@ -30,6 +30,36 @@
# ============ # ============
# #
# To uninstall, just remove the line from your .bash_profile and .bashrc. # 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() _django_completion()
{ {

View File

@@ -1,5 +1,20 @@
#!/bin/bash #!/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 # bash completion for docker-compose
# #
# This work is based on the completion for the docker command. # This work is based on the completion for the docker command.

View File

@@ -1,5 +1,20 @@
# #
# bash completion file for docker-machine commands # 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: # This script provides completion of:
# - commands and their options # - commands and their options

View File

@@ -1,37 +1,2 @@
#!/usr/bin/env bash _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.'
# 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

View File

@@ -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 ':' # Bash breaks words on : by default. Subproject tasks have ':'
# Avoid inaccurate completions for subproject tasks # Avoid inaccurate completions for subproject tasks
COMP_WORDBREAKS=$(echo "$COMP_WORDBREAKS" | sed -e 's/://g') COMP_WORDBREAKS=$(echo "$COMP_WORDBREAKS" | sed -e 's/://g')

View File

@@ -3,9 +3,35 @@
# grunt-cli # grunt-cli
# http://gruntjs.com/ # http://gruntjs.com/
# #
# Copyright (c) 2012 Tyler Kellen, contributors # Copyright jQuery Foundation and other contributors, https://jquery.org/
# Licensed under the MIT license.
# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT # 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: # Usage:
# #

View File

@@ -2,9 +2,36 @@
# Borrowed from grunt-cli # Borrowed from grunt-cli
# http://gruntjs.com/ # http://gruntjs.com/
# #
# Copyright (c) 2012 Tyler Kellen, contributors # Copyright jQuery Foundation and other contributors, https://jquery.org/
# Licensed under the MIT license.
# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT # 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: # Usage:
# #
# To enable bash <tab> completion for gulp, add the following line (minus the # To enable bash <tab> completion for gulp, add the following line (minus the

View File

@@ -1,59 +1,2 @@
# Bash completion script for 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.'
# 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

View File

@@ -1,6 +1,27 @@
# hub tab-completion script for bash. # hub tab-completion script for bash.
# This script complements the completion script that ships with git. # 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 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 if ! declare -F _git > /dev/null && declare -F _completion_loader > /dev/null; then
_completion_loader git _completion_loader git

View File

@@ -1,4 +1,28 @@
# Invoke (pyinvoke.org) tab-completion script to be sourced with Bash shell. # 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 # https://github.com/pyinvoke/invoke/blob/master/completion/bash
_complete_invoke() { _complete_invoke() {

View File

@@ -3,8 +3,27 @@
# DATE: 2012-10-30 # DATE: 2012-10-30
# rparree-at-edc4it-dot-com # 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(){ _serverProfiles(){
if [[ $COMP_WORDS == *standalone.sh* ]] if [[ $COMP_WORDS == *standalone.sh* ]]

View File

@@ -1,163 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cite "about-completion"
about-completion "packer completion"
# Packer (http://www.packer.io) bash completion if _binary_exists packer; then
# complete -C packer packer
# This script provides bash completion for packer and supports: fi
#
# - 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"
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

View File

@@ -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 # written by David Pravec
# - feel free to /msg alekibango on IRC if you want to talk about this file # - feel free to /msg alekibango on IRC if you want to talk about this file

View File

@@ -3,7 +3,6 @@
# tmux completion # tmux completion
# See: http://www.debian-administration.org/articles/317 for how to write more. # See: http://www.debian-administration.org/articles/317 for how to write more.
# Usage: Put "source bash_completion_tmux.sh" into your .bashrc # Usage: Put "source bash_completion_tmux.sh" into your .bashrc
# Based upon the example at http://paste-it.appspot.com/Pj4mLycDE
_tmux_expand () _tmux_expand ()
{ {

View File

@@ -1,70 +1,2 @@
# link: https://github.com/ginatrapani/todo.txt-cli/blob/master/todo_completion _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.'
_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

View File

@@ -1,51 +1,7 @@
# --------------------------------------------------------------------------- #!/usr/bin/env bash
# vault-bash-completion cite "about-completion"
# about-completion "vault completion"
# This adds bash completions for [HashiCorp Vault](https://www.vaultproject.io/)
#
# see https://github.com/iljaweis/vault-bash-completion
# ---------------------------------------------------------------------------
function _vault_mounts() { if _binary_exists vault; then
( complete -C vault vault
set -euo pipefail fi
if ! vault mounts 2> /dev/null | awk 'NR > 1 {print $1}'; then
echo "secret"
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

View File

@@ -1,148 +1,2 @@
#!/usr/bin/env bash _log_error 'Bash completion for "virsh" is now deprecated, as it used code with incompatible license.
# bash completion for virsh - main CLI of libvirt Please disable this completion and use the instructions from "virsh" developers instead.'
# 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

View File

@@ -1,6 +1,7 @@
# Bash-it # Bash-it
![Build Status](https://github.com/Bash-it/bash-it/workflows/CI/badge.svg?branch=master) ![Build Status](https://github.com/Bash-it/bash-it/workflows/CI/badge.svg?branch=master)
[![Join the chat at https://gitter.im/Bash-it/bash-it](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Bash-it/bash-it?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ![Docs Status](https://readthedocs.org/projects/bash-it/badge/)
[![Join the chat at https://webchat.freenode.net/?channel=#bash-it](https://img.shields.io/badge/chat-on%20freenode-brightgreen.svg)](https://webchat.freenode.net/?channel=#bash-it)
**Bash-it** is a collection of community Bash commands and scripts for Bash 3.2+. **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:) (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! 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. 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) - [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) - [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) - [via Docker](https://bash-it.readthedocs.io/en/latest/installation/#install-using-docker)
- [Updating](https://bash-it.readthedocs.io/en/latest/installation/#updating) - [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) - [Help Out](https://bash-it.readthedocs.io/en/latest/#help-out)
- [Contributors](#contributors) - [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 ## 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. 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.

View File

@@ -31,7 +31,8 @@ release = ''
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. # ones.
extensions = [ extensions = [
'sphinx_rtd_theme' 'sphinx_rtd_theme',
'sphinxemoji.sphinxemoji',
] ]
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.

View File

@@ -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 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. * 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>`_. 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``. * 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. * 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>`. 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. * Ideally, you should add a ``<theme_name>.rst`` file describing the theme and its configuration options to ``docs/themes-list`` folder.

View File

@@ -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. 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 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>`_. `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
View 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

View File

@@ -3,74 +3,8 @@
Misc Misc
---- ----
Help Screens .. toctree::
^^^^^^^^^^^^ :maxdepth: 2
.. code-block:: bash help_screens
proxy_support
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.

43
docs/proxy_support.rst Normal file
View 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.

View File

@@ -1,2 +1,3 @@
sphinx == 3.2.1 sphinx==3.2.1
sphinx-rtd-theme==0.5.0 sphinx-rtd-theme==0.5.0
sphinxemoji==0.1.8

View File

@@ -38,6 +38,7 @@ Default theme glyphs
BARBUK_SVN_CHAR='⑆ ' BARBUK_SVN_CHAR='⑆ '
BARBUK_EXIT_CODE_ICON=' ' BARBUK_EXIT_CODE_ICON=' '
BARBUK_PYTHON_VENV_CHAR=' ' BARBUK_PYTHON_VENV_CHAR=' '
BARBUK_COMMAND_DURATION_ICON='  '
Customize glyphs Customize glyphs
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
@@ -92,6 +93,11 @@ Please refer to the following documentation for more information:
EOF EOF
chmod 400 /etc/sudoers.d/keepenv chmod 400 /etc/sudoers.d/keepenv
Command duration
----------------
See :ref:`Command duration <command_duration>`.
Examples Examples
-------- --------
@@ -122,3 +128,11 @@ Python venv
.. code-block:: bash .. code-block:: bash
  flask ~/test on  master ✓   flask ~/test on  master ✓
Command duration
^^^^^^^^^^^^^^^^
.. code-block:: bash
# sleep 3s
user@hostname in  ~/bash-it on  master ✓  3.2s

View File

@@ -37,6 +37,29 @@ See :ref:`here <list_of_themes>`.
Theme Switches & Variables 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 Clock Related
============= =============

View File

@@ -171,6 +171,8 @@ elif [[ $silent ]] && ! [[ $no_modify_config ]]; then
backup_new backup_new
fi fi
# Disable auto-reload in case its enabled
export BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE=''
# Load dependencies for enabling components # Load dependencies for enabling components
source "$BASH_IT/lib/composure.bash" source "$BASH_IT/lib/composure.bash"
source "$BASH_IT/lib/utilities.bash" source "$BASH_IT/lib/utilities.bash"

View File

@@ -346,6 +346,11 @@ _bash-it-version() {
BASH_IT_GIT_REMOTE=$(git remote get-url $BASH_IT_REMOTE) BASH_IT_GIT_REMOTE=$(git remote get-url $BASH_IT_REMOTE)
BASH_IT_GIT_URL=${BASH_IT_GIT_REMOTE%.git} 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) current_tag=$(git describe --exact-match --tags 2> /dev/null)

View File

@@ -91,5 +91,5 @@ function alias_completion {
echo "$new_completion" >> "$tmp_file" echo "$new_completion" >> "$tmp_file"
fi fi
done < <(alias -p | sed -Ene "s/$alias_regex/\2 '\3' '\4'/p") 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 }; alias_completion

View File

@@ -11,12 +11,15 @@ function _set-prefix-based-on-path()
if [ "$1" != "skip" ] && [ -d "./enabled" ]; then if [ "$1" != "skip" ] && [ -d "./enabled" ]; then
_bash_it_config_type="" _bash_it_config_type=""
if [[ "${1}" =~ ^(alias|completion|plugin)$ ]]; then
_bash_it_config_type=$1 case $1 in
_log_debug "Loading enabled $1 components..." alias|completion|plugin)
else _bash_it_config_type=$1
_log_debug "Loading all enabled components..." _log_debug "Loading enabled $1 components..." ;;
fi *|'')
_log_debug "Loading all enabled components..." ;;
esac
for _bash_it_config_file in $(sort <(compgen -G "./enabled/*${_bash_it_config_type}.bash")); do for _bash_it_config_file in $(sort <(compgen -G "./enabled/*${_bash_it_config_type}.bash")); do
if [ -e "${_bash_it_config_file}" ]; then if [ -e "${_bash_it_config_file}" ]; then
_set-prefix-based-on-path "${_bash_it_config_file}" _set-prefix-based-on-path "${_bash_it_config_file}"
@@ -29,19 +32,21 @@ if [ "$1" != "skip" ] && [ -d "./enabled" ]; then
done done
fi fi
if [ -n "${2}" ] && [ -d "${2}/enabled" ]; then
if [ ! -z "${2}" ] && [[ "${2}" =~ ^(aliases|completion|plugins)$ ]] && [ -d "${2}/enabled" ]; then case $2 in
_log_warning "Using legacy enabling for $2, please update your bash-it version and migrate" aliases|completion|plugins)
for _bash_it_config_file in $(sort <(compgen -G "./${2}/enabled/*.bash")); do _log_warning "Using legacy enabling for $2, please update your bash-it version and migrate"
if [ -e "$_bash_it_config_file" ]; then for _bash_it_config_file in $(sort <(compgen -G "./${2}/enabled/*.bash")); do
_set-prefix-based-on-path "${_bash_it_config_file}" if [ -e "$_bash_it_config_file" ]; then
_log_debug "Loading component..." _set-prefix-based-on-path "${_bash_it_config_file}"
# shellcheck source=/dev/null _log_debug "Loading component..."
source "$_bash_it_config_file" # shellcheck source=/dev/null
else source "$_bash_it_config_file"
echo "Unable to locate ${_bash_it_config_file}" > /dev/stderr else
fi echo "Unable to locate ${_bash_it_config_file}" > /dev/stderr
done fi
done ;;
esac
fi fi
unset _bash_it_config_file unset _bash_it_config_file

View File

@@ -51,6 +51,13 @@ export SCM_CHECK=true
# Will otherwise fall back on $USER. # Will otherwise fall back on $USER.
#export SHORT_USER=${USER:0:8} #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. # Set Xterm/screen/Tmux title with shortened command and directory.
# Uncomment this to set. # Uncomment this to set.
#export SHORT_TERM_LINE=true #export SHORT_TERM_LINE=true

View File

@@ -7,7 +7,7 @@ load ../../lib/helpers
cite _about _param _example _group _author _version 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" { @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" 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 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
View File

@@ -0,0 +1 @@
../../docs/themes-list/barbuk.rst

View File

@@ -11,6 +11,11 @@ SCM_HG_CHAR=${BARBUK_HG_CHAR:='☿ '}
SCM_SVN_CHAR=${BARBUK_SVN_CHAR:='⑆ '} SCM_SVN_CHAR=${BARBUK_SVN_CHAR:='⑆ '}
EXIT_CODE_ICON=${BARBUK_EXIT_CODE_ICON:=' '} EXIT_CODE_ICON=${BARBUK_EXIT_CODE_ICON:=' '}
PYTHON_VENV_CHAR=${BARBUK_PYTHON_VENV_CHAR:=' '} 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 user and hostname display
SSH_INFO=${BARBUK_SSH_INFO:=true} SSH_INFO=${BARBUK_SSH_INFO:=true}
@@ -67,7 +72,9 @@ function _exit-code {
} }
function _prompt { 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 _exit-code exit_code
_git-uptream-remote-logo _git-uptream-remote-logo
@@ -96,9 +103,8 @@ function _prompt {
python_venv="$PYTHON_VENV_CHAR$(basename "${VIRTUAL_ENV}") " python_venv="$PYTHON_VENV_CHAR$(basename "${VIRTUAL_ENV}") "
fi fi
PS1="\\n${ssh_info} ${purple}$(scm_char)${python_venv}${dir_color}\\w${normal}$(scm_prompt_info)${exit_code}" 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} -gt $((COLUMNS*3)) ]] && wrap_char="\\n"
PS1="${PS1}${wrap_char}${normal} " PS1="${PS1}${wrap_char}${normal} "
} }

View 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

View File

@@ -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_PREFIX=""
SCM_THEME_PROMPT_SUFFIX="" SCM_THEME_PROMPT_SUFFIX=""