From 449d6d4fe1d969a5d60ae71db1440221304dfa48 Mon Sep 17 00:00:00 2001 From: Willy Barro Date: Tue, 25 Sep 2012 17:59:45 -0300 Subject: [PATCH 01/68] Add aliases for GIT-SVN (rebase and dcommit) - Add "gsr" for "git svn rebase" - Add "gsd" for "git svn dcommit" --- aliases/available/git.aliases.bash | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index bbac313b..37cb0ab5 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -28,6 +28,10 @@ alias gdel='git branch -D' alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master' alias gll='git log --graph --pretty=oneline --abbrev-commit' +# Git SVN +alias gsr='git svn rebase' +alias gsd='git svn dcommit' + case $OSTYPE in linux*) alias gd='git diff | vim -R -' From 8a36f21ca1f828b7a84d7a022993415ee870012d Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Wed, 21 Oct 2020 00:14:11 +0300 Subject: [PATCH 02/68] Add _binary_exists and use in github-cli completion gh was also used as an git alias, and caused _command_exists to not fail as expected --- completion/available/github-cli.completion.bash | 2 +- lib/helpers.bash | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/completion/available/github-cli.completion.bash b/completion/available/github-cli.completion.bash index 2fb3d370..7b7c9fa0 100644 --- a/completion/available/github-cli.completion.bash +++ b/completion/available/github-cli.completion.bash @@ -2,7 +2,7 @@ cite "about-completion" about-completion "GitHub CLI completion" -if _command_exists gh; then +if _binary_exists gh; then if _command_exists brew; then _log_warning "You don't need github-cli completion enabled if you have system completion enabled" fi diff --git a/lib/helpers.bash b/lib/helpers.bash index 8917ed50..a709d507 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -26,6 +26,17 @@ function _command_exists () type "$1" &> /dev/null || (_log_warning "$msg" && return 1) ; } +function _binary_exists () +{ + _about 'checks for existence of a binary' + _param '1: binary to check' + _param '2: (optional) log message to include when binary not found' + _example '$ _binary_exists ls && echo exists' + _group 'lib' + local msg="${2:-Binary '$1' does not exist!}" + type -P "$1" &> /dev/null || (_log_warning "$msg" && return 1) ; +} + function _make_reload_alias() { echo "source \${BASH_IT}/scripts/reloader.bash ${1} ${2}" } From 3838f1249825d3516fcc7825f74b8a962863a40c Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Wed, 21 Oct 2020 11:02:55 +0300 Subject: [PATCH 03/68] Add tests for _binary_exists --- test/lib/helpers.bats | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/lib/helpers.bats b/test/lib/helpers.bats index 70481b32..0a58be34 100644 --- a/test/lib/helpers.bats +++ b/test/lib/helpers.bats @@ -39,6 +39,26 @@ function local_setup { assert_failure } +@test "helpers: _binary_exists function exists" { + run type -a _binary_exists &> /dev/null + assert_success +} + +@test "helpers: _binary_exists function positive test ls" { + run _binary_exists ls + assert_success +} + +@test "helpers: _binary_exists function negative test function" { + run _binary_exists _binary_exists + assert_failure +} + +@test "helpers: _binary_exists function negative test" { + run _binary_exists __addfkds_dfdsjdf + assert_failure +} + @test "helpers: bash-it help aliases ag" { run bash-it help aliases "ag" assert_line -n 0 "ag='ag --smart-case --pager=\"less -MIRFX'" From 825fc88a8ffd5862676762ff581662428b4b2f78 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sun, 25 Oct 2020 15:24:19 +0200 Subject: [PATCH 04/68] Rename _bash-it_update to _bash-it-update --- lib/helpers.bash | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index a709d507..58e5ffc3 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -91,7 +91,7 @@ bash-it () _bash-it-search $component "$@" return;; update) - func=_bash-it_update-$component;; + func=_bash-it-update-$component;; migrate) func=_bash-it-migrate;; version) @@ -169,18 +169,18 @@ _bash-it-plugins () _bash-it-describe "plugins" "a" "plugin" "Plugin" } -_bash-it_update-dev() { +_bash-it-update-dev() { _about 'updates Bash-it to the latest master' _group 'lib' - _bash-it_update- dev "$@" + _bash-it-update- dev "$@" } -_bash-it_update-stable() { +_bash-it-update-stable() { _about 'updates Bash-it to the latest tag' _group 'lib' - _bash-it_update- stable "$@" + _bash-it-update- stable "$@" } _bash-it_pull_and_update_inner() { @@ -198,7 +198,7 @@ _bash-it_pull_and_update_inner() { fi } -_bash-it_update-() { +_bash-it-update-() { _about 'updates Bash-it' _param '1: What kind of update to do (stable|dev)' _group 'lib' From e023d6f85123f7aa36e4119aa57c9088d157c1a1 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Tue, 27 Oct 2020 20:01:45 +0200 Subject: [PATCH 05/68] Improve bash-it version output As we now have "stable" releases and "dev" type of versions, `version` command should provide usefull output on that --- lib/helpers.bash | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index 58e5ffc3..270a31b9 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -347,12 +347,22 @@ _bash-it-version() { BASH_IT_GIT_REMOTE=$(git remote get-url $BASH_IT_REMOTE) BASH_IT_GIT_URL=${BASH_IT_GIT_REMOTE%.git} - BASH_IT_GIT_VERSION_INFO="$(git log --pretty=format:'%h on %aI' -n 1)" - BASH_IT_GIT_SHA=${BASH_IT_GIT_VERSION_INFO%% *} + current_tag=$(git describe --exact-match --tags 2> /dev/null) - echo "Current git SHA: $BASH_IT_GIT_VERSION_INFO" - echo "$BASH_IT_GIT_URL/commit/$BASH_IT_GIT_SHA" - echo "Compare to latest: $BASH_IT_GIT_URL/compare/$BASH_IT_GIT_SHA...master" + if [[ -z $current_tag ]]; then + BASH_IT_GIT_VERSION_INFO="$(git log --pretty=format:'%h on %aI' -n 1)" + TARGET=${BASH_IT_GIT_VERSION_INFO%% *} + echo "Version type: dev" + echo "Current git SHA: $BASH_IT_GIT_VERSION_INFO" + echo "Commit info: $BASH_IT_GIT_URL/commit/$TARGET" + else + TARGET=$current_tag + echo "Version type: stable" + echo "Current tag: $current_tag" + echo "Tag information: $BASH_IT_GIT_URL/releases/tag/$current_tag" + fi + + echo "Compare to latest: $BASH_IT_GIT_URL/compare/$TARGET...master" cd - &> /dev/null || return } From 313abebbb09cb30534361c276be5ba29702cb59f Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Tue, 27 Oct 2020 20:06:37 +0200 Subject: [PATCH 06/68] git: Add git push --delete alias --- aliases/available/git.aliases.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index be8d7330..6b2badaa 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -28,6 +28,7 @@ alias gpr='git pull --rebase' alias gpp='git pull && git push' alias gup='git fetch && git rebase' alias gp='git push' +alias gpd='git push --delete' alias gpo='git push origin HEAD' alias gpu='git push --set-upstream' alias gpuo='git push --set-upstream origin' From 9ac6a6ab964d4f77356376042138fc08d206b5f0 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Tue, 15 Oct 2019 14:34:32 +0300 Subject: [PATCH 07/68] Enforce some coding standards for the contributers --- .pre-commit-config.yaml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..2443753a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,35 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +--- +# fail_fast: true +minimum_pre_commit_version: 1.18.1 +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-docstring-first + - id: check-merge-conflict + - id: requirements-txt-fixer + - id: double-quote-string-fixer + - id: forbid-new-submodules + - id: mixed-line-ending + - id: check-added-large-files + - repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: 1.11.0 + hooks: + - id: forbid-binary + - id: git-check # Configure in .gitattributes + - id: git-dirty # Configure in .gitignore + - id: markdownlint # Configure in .mdlrc + - id: shellcheck + - id: shfmt + - repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.1.7 + hooks: + # - id: forbid-crlf + - id: remove-crlf + # - id: forbid-tabs + - id: remove-tabs + args: [--whitespaces-count, '2'] # defaults to: 4 From 250bd2bbd8d74885427e19e2bcff407a589809b2 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Tue, 15 Oct 2019 15:05:52 +0300 Subject: [PATCH 08/68] Add a note on how to use the pre-commit yaml. --- DEVELOPMENT.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index e2fc7bd5..2f7941cb 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -64,3 +64,11 @@ These items are subject to change. When making changes to the internal functiona Plugins can define a function that will be called when the plugin is being disabled. The callback name should be `{PLUGIN_NAME}_on_disable`, you can see `gitstatus` for usage example. + +## Using the pre-commit hook + +Note the file .pre-commit-config.yaml at the top of the repo. +This file configures the behavior of the a pre-commit hook based on [the Pre-Commit framework](https://pre-commit.com/). Please see the site about +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). From d986261f98c25a259b593feba290cfa9ab9156fc Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Tue, 15 Oct 2019 16:17:16 +0300 Subject: [PATCH 09/68] another round of refinements after PR #1434 --- .pre-commit-config.yaml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2443753a..4fa61012 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,20 +9,13 @@ repos: hooks: - id: trailing-whitespace - id: end-of-file-fixer - - id: check-docstring-first - id: check-merge-conflict - - id: requirements-txt-fixer - - id: double-quote-string-fixer - - id: forbid-new-submodules - id: mixed-line-ending - id: check-added-large-files - repo: https://github.com/jumanjihouse/pre-commit-hooks rev: 1.11.0 hooks: - - id: forbid-binary - id: git-check # Configure in .gitattributes - - id: git-dirty # Configure in .gitignore - - id: markdownlint # Configure in .mdlrc - id: shellcheck - id: shfmt - repo: https://github.com/Lucas-C/pre-commit-hooks @@ -33,3 +26,4 @@ repos: # - id: forbid-tabs - id: remove-tabs args: [--whitespaces-count, '2'] # defaults to: 4 + exclude: .gitmodules From 5045867b2c3c0940da5d4ad9241facadd2a30d71 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Tue, 10 Mar 2020 10:09:32 +0200 Subject: [PATCH 10/68] Don't touch tab indentations, they are there for a good reason --- .pre-commit-config.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4fa61012..51e4318d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,7 +23,3 @@ repos: hooks: # - id: forbid-crlf - id: remove-crlf - # - id: forbid-tabs - - id: remove-tabs - args: [--whitespaces-count, '2'] # defaults to: 4 - exclude: .gitmodules From b14a38fec953e3d1558b6f095c9f588c1c5c1012 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sun, 21 Jun 2020 16:01:05 +0300 Subject: [PATCH 11/68] ci: Add pre-commit run and remove trailling spaces --- .travis.yml | 26 +++++++++++++++++++++++--- test/lint-requirements.txt | 1 + 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 test/lint-requirements.txt diff --git a/.travis.yml b/.travis.yml index 12d5e15e..68624bc8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,19 +12,39 @@ os: linux dist: xenial +cache: + directories: + - "${HOME}/.cache/pip" + - "${HOME}/.cache/pre-commit" + - "${HOME}/.pre-commit-venv" + - "${HOME}/bin" + - /usr/lib/python3.8 + jobs: + include: + - language: go + go: "1.14" + name: Ubuntu 18.04 + dist: bionic + sudo: required + before_script: + GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt; + curl https://pre-commit.com/install-local.py | python3 - + script: + SKIP=shellcheck pre-commit run --all-files; + - <<: *native_job name: Ubuntu 16.04 - + - <<: *native_job name: Ubuntu 18.04 dist: bionic - + - <<: *native_job name: MacOS xcode9.4 os: osx osx_image: xcode9.4 # Default xcode on Travis. - + - <<: *native_job name: MacOS xcode11.5 os: osx diff --git a/test/lint-requirements.txt b/test/lint-requirements.txt new file mode 100644 index 00000000..72224bf8 --- /dev/null +++ b/test/lint-requirements.txt @@ -0,0 +1 @@ +pre-commit==2.3.0 From 45d076567a13635f5a266261fca384801d5af22d Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sun, 21 Jun 2020 21:32:46 +0300 Subject: [PATCH 12/68] Add simple shellcheckrc --- .shellcheckrc | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .shellcheckrc diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 00000000..6418bd8f --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1,6 @@ +# We use colors and not assigned +disable=SC2154 +# Hard to fix +disable=SC2155 +# shellcheck is wrong on some +disable=SC2034 From 2acf26b7b3c1b976e7f9ecac9dd2793f67836f55 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Tue, 13 Oct 2020 17:20:11 +0300 Subject: [PATCH 13/68] pre-commit: Do not run shfmt/shellcheck on .bats files --- .pre-commit-config.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 51e4318d..696fabf4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,9 @@ repos: hooks: - id: git-check # Configure in .gitattributes - id: shellcheck + exclude: ".bats$" - id: shfmt + exclude: ".bats$" - repo: https://github.com/Lucas-C/pre-commit-hooks rev: v1.1.7 hooks: From d150fc6ec18ef8b81fd781ef9bc75646675ce4a5 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Thu, 15 Oct 2020 23:49:52 +0300 Subject: [PATCH 14/68] ci: Run pre-commit only on whitelisted files --- .travis.yml | 2 +- clean_files.txt | 0 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 clean_files.txt diff --git a/.travis.yml b/.travis.yml index 68624bc8..535709c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ jobs: GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt; curl https://pre-commit.com/install-local.py | python3 - script: - SKIP=shellcheck pre-commit run --all-files; + pre-commit run --files `cat clean_files.txt`; - <<: *native_job name: Ubuntu 16.04 diff --git a/clean_files.txt b/clean_files.txt new file mode 100644 index 00000000..e69de29b From c42e3e8b211d63ac3028bd1fc62342a9c3386d80 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Tue, 10 Mar 2020 10:16:02 +0200 Subject: [PATCH 15/68] Removed trailing whitespaces --- aliases/available/clipboard.aliases.bash | 2 +- completion/available/gem.completion.bash | 4 +- completion/available/git_flow.completion.bash | 40 ++++++------ completion/available/jboss7.completion.bash | 40 ++++++------ completion/available/laravel.completion.bash | 3 +- completion/available/salt.completion.bash | 61 +++++++++---------- completion/available/sqlmap.completion.bash | 8 +-- completion/available/ssh.completion.bash | 4 +- completion/available/virsh.completion.bash | 4 +- .../available/virtualbox.completion.bash | 28 ++++----- completion/available/vuejs.completion.bash | 2 +- completion/available/wpscan.completion.bash | 3 +- plugins/available/autojump.plugin.bash | 2 +- plugins/available/git.plugin.bash | 4 +- plugins/available/postgres.plugin.bash | 11 ++-- plugins/available/powerline.plugin.bash | 2 +- themes/atomic/atomic.theme.bash | 16 ++--- themes/barbuk/README.md | 2 +- themes/codeword/README.md | 2 +- themes/essential/essential.theme.bash | 2 +- themes/hawaii50/hawaii50.theme.bash | 16 ++--- themes/n0qorg/n0qorg.theme.bash | 2 +- themes/parrot/parrot.theme.bash | 2 +- themes/powerline-multiline/README.md | 2 +- themes/pure/pure.theme.bash | 10 +-- themes/ramses/ramses.theme.bash | 6 +- themes/sirup/sirup.theme.bash | 2 +- themes/zork/zork.theme.bash | 6 +- 28 files changed, 140 insertions(+), 146 deletions(-) diff --git a/aliases/available/clipboard.aliases.bash b/aliases/available/clipboard.aliases.bash index 528e2d0e..c6c15519 100644 --- a/aliases/available/clipboard.aliases.bash +++ b/aliases/available/clipboard.aliases.bash @@ -7,7 +7,7 @@ case $OSTYPE in [[ $XCLIP ]] && \ alias pbcopy="$XCLIP -selection clipboard" && \ alias pbpaste="$XCLIP -selection clipboard -o" - ;; + ;; esac # to use it just install xclip on your distribution and it would work like: diff --git a/completion/available/gem.completion.bash b/completion/available/gem.completion.bash index de986e08..2d098529 100644 --- a/completion/available/gem.completion.bash +++ b/completion/available/gem.completion.bash @@ -6,7 +6,7 @@ _installcomp() { then REMOTE_GEMS=( $(gem list --remote --no-versions | tr '\n' ' ') ) fi - + local cur=${COMP_WORDS[COMP_CWORD]} COMPREPLY=( $(compgen -W "${REMOTE_GEMS[*]}" -- $cur) ) } @@ -16,7 +16,7 @@ _uninstallcomp() { then LOCAL_GEMS=( $(gem list --no-versions | sed 's/\*\*\* LOCAL GEMS \*\*\*//' | tr '\n' ' ') ) fi - + local cur=${COMP_WORDS[COMP_CWORD]} COMPREPLY=( $(compgen -W "${LOCAL_GEMS[*]}" -- $cur) ) } diff --git a/completion/available/git_flow.completion.bash b/completion/available/git_flow.completion.bash index c76d323b..04f20ccd 100644 --- a/completion/available/git_flow.completion.bash +++ b/completion/available/git_flow.completion.bash @@ -2,47 +2,47 @@ # # git-flow-completion # =================== -# +# # Bash completion support for [git-flow](http://github.com/nvie/gitflow) -# +# # The contained completion routines provide support for completing: -# +# # * git-flow init and version # * feature, hotfix and release branches # * remote feature branch names (for `git-flow feature track`) -# -# +# +# # Installation # ------------ -# +# # To achieve git-flow completion nirvana: -# +# # 0. Install git-completion. -# +# # 1. Install this file. Either: -# +# # a. Place it in a `bash-completion.d` folder: -# +# # * /etc/bash-completion.d # * /usr/local/etc/bash-completion.d # * ~/bash-completion.d -# +# # b. Or, copy it somewhere (e.g. ~/.git-flow-completion.sh) and put the following line in # your .bashrc: -# +# # source ~/.git-flow-completion.sh -# +# # 2. If you are using Git < 1.7.1: Edit git-completion.sh and add the following line to the giant # $command case in _git: -# +# # flow) _git_flow ;; -# -# +# +# # The Fine Print # -------------- -# +# # Copyright (c) 2010 [Justin Hileman](http://justinhileman.com) -# +# # Distributed under the [MIT License](http://creativecommons.org/licenses/MIT/) _git_flow () @@ -128,7 +128,7 @@ __git_flow_release () __gitcomp "$subcommands" return fi - + case "$subcommand" in finish) __gitcomp "$(__git_flow_list_releases)" @@ -174,4 +174,4 @@ __git_flow_list_hotfixes () # temporarily wrap __git_find_on_cmdline() for backwards compatibility if [ -z "`type -t __git_find_subcommand`" ]; then alias __git_find_subcommand=__git_find_on_cmdline -fi \ No newline at end of file +fi diff --git a/completion/available/jboss7.completion.bash b/completion/available/jboss7.completion.bash index 66d07179..0bb44f15 100644 --- a/completion/available/jboss7.completion.bash +++ b/completion/available/jboss7.completion.bash @@ -14,17 +14,17 @@ _serverProfiles(){ # assume is domain.sh serverdir="../domain/configuration/" fi - + for i in ${!COMP_WORDS[*]} do if [[ "${COMP_WORDS[i]}" == "-Djboss.server.base.dir" || "${COMP_WORDS[i]}" == "-Djboss.domain.base.dir" ]]; then serverdir="${COMP_WORDS[i+2]}/configuration" - fi - + fi + done if [ -d "${serverdir}" ] then - + IFS=$'\n' tmp="$(ls "${serverdir}" | grep xml)" local fls="${tmp[@]// /\ }" unset IFS @@ -42,13 +42,13 @@ _bindingAddress(){ } _jboss(){ - + local cur prev words cword COMPREPLY=() _get_comp_words_by_ref -n = cur prev words cword - + case $cur in - + -Djboss.socket.binding.port-offset=*) cur=${cur#*=} #static list of common bindings sets @@ -70,13 +70,13 @@ _jboss(){ COMPREPLY=( $(compgen -W "${booleans}" -- ${cur}) ) return 0 ;; - + -Djboss.server.base.dir=*|-Djboss.home.dir=*|-Djboss.domain.base.dir=*) cur=${cur#*=} _filedir -d return 0 ;; - + -Djboss.domain.master.address=*|-Djboss.bind.address*=*) cur=${cur#*=} _bindingAddress @@ -85,8 +85,8 @@ _jboss(){ --server-config=*|-c=|--host-config=*) cur=${cur#*=} _serverProfiles - return 0 - + return 0 + esac @@ -110,14 +110,14 @@ _jboss(){ ;; esac # *** from jboss5 ******************** - # *** -modulepath -c -m -g -l -d -p -n -B -L -C -Djboss.platform.mbeanserver -Djboss.server.base.directory + # *** -modulepath -c -m -g -l -d -p -n -B -L -C -Djboss.platform.mbeanserver -Djboss.server.base.directory # *** -Djboss.Domain -Djboss.modcluster.proxyList -Djboss.jvmRoute -Djboss.default.jgroups.stack -Dorg.jboss.ejb3.remoting.IsLocalInterceptor.passByRef -Djboss.platform.mbeanserver -Dcom.sun.management.jmxremote.port -Dcom.sun.management.jmxremote.ssl # ************************************* - + # standard commands for standalone and domain mode local commandsWithoutEqualSign='-b -bmanagement -bunsecure -bpublic --admin-only -h -help -u -version -V -v' local commandsWithEqualSign='-P -Djboss.node.name -Djboss.home.dir -Djboss.socket.binding.port-offset -Djboss.bind.address.management -Djboss.bind.address -Djboss.bind.address.unsecure' - + if [[ $COMP_WORDS == *standalone.sh* ]] then commandsWithoutEqualSign="${commandsWithoutEqualSign} -c" @@ -127,15 +127,15 @@ _jboss(){ commandsWithoutEqualSign="${commandsWithoutEqualSign} --backup --cached-dc" commandsWithEqualSign="${commandsWithEqualSign} -Djboss.domain.master.address --host-config -Djboss.domain.master.port -Djboss.domain.base.dir " fi - - - - COMPREPLY=( $( compgen -W "$commandsWithoutEqualSign" -- "$cur" ) - $( compgen -W "$commandsWithEqualSign" -S '=' -- "$cur" ) ) + + + + COMPREPLY=( $( compgen -W "$commandsWithoutEqualSign" -- "$cur" ) + $( compgen -W "$commandsWithEqualSign" -S '=' -- "$cur" ) ) return 0 - + } complete -o nospace -F _jboss standalone.sh complete -o nospace -F _jboss domain.sh diff --git a/completion/available/laravel.completion.bash b/completion/available/laravel.completion.bash index bf24f67e..7bd6f223 100644 --- a/completion/available/laravel.completion.bash +++ b/completion/available/laravel.completion.bash @@ -10,7 +10,6 @@ if command -v laravel > /dev/null; then fi done } - + complete -F __laravel_completion laravel fi - diff --git a/completion/available/salt.completion.bash b/completion/available/salt.completion.bash index e8cb5b25..7634dcdc 100644 --- a/completion/available/salt.completion.bash +++ b/completion/available/salt.completion.bash @@ -13,7 +13,7 @@ _salt_get_grains(){ - if [ "$1" = 'local' ] ; then + if [ "$1" = 'local' ] ; then salt-call --out=txt -- grains.ls | sed 's/^.*\[//' | tr -d ",']" |sed 's:\([a-z0-9]\) :\1\: :g' else salt '*' --timeout 2 --out=txt -- grains.ls | sed 's/^.*\[//' | tr -d ",']" |sed 's:\([a-z0-9]\) :\1\: :g' @@ -22,15 +22,15 @@ _salt_get_grains(){ _salt_get_grain_values(){ if [ "$1" = 'local' ] ; then - salt-call --out=txt -- grains.item $1 |sed 's/^\S*:\s//' |grep -v '^\s*$' + salt-call --out=txt -- grains.item $1 |sed 's/^\S*:\s//' |grep -v '^\s*$' else - salt '*' --timeout 2 --out=txt -- grains.item $1 |sed 's/^\S*:\s//' |grep -v '^\s*$' + salt '*' --timeout 2 --out=txt -- grains.item $1 |sed 's/^\S*:\s//' |grep -v '^\s*$' fi } _salt(){ - local cur prev opts _salt_grains _salt_coms pprev ppprev + local cur prev opts _salt_grains _salt_coms pprev ppprev COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" @@ -58,11 +58,11 @@ _salt(){ case "${pprev}" in -G|--grain|--grain-pcre) if [ "${cur}" = ":" ]; then - COMPREPLY=($(compgen -W "`_salt_get_grain_values ${prev}`" )) + COMPREPLY=($(compgen -W "`_salt_get_grain_values ${prev}`" )) return 0 fi ;; - esac + esac case "${ppprev}" in -G|--grain|--grain-pcre) if [ "${prev}" = ":" ]; then @@ -70,17 +70,17 @@ _salt(){ return 0 fi ;; - esac - + esac + if [ "${cur}" = "=" ] && [[ "${prev}" == --* ]]; then - cur="" + cur="" fi if [ "${prev}" = "=" ] && [[ "${pprev}" == --* ]]; then prev="${pprev}" fi - + case "${prev}" in - + -c|--config) COMPREPLY=($(compgen -f -- ${cur})) return 0 @@ -89,12 +89,12 @@ _salt(){ COMPREPLY=($(compgen -W "\'*\' ${opts} `salt-key --no-color -l acc`" -- ${cur})) return 0 ;; - -E|--pcre) + -E|--pcre) COMPREPLY=($(compgen -W "`salt-key --no-color -l acc`" -- ${cur})) return 0 ;; -G|--grain|--grain-pcre) - COMPREPLY=($(compgen -W "$(_salt_get_grains)" -- ${cur})) + COMPREPLY=($(compgen -W "$(_salt_get_grains)" -- ${cur})) return 0 ;; -C|--compound) @@ -109,10 +109,10 @@ _salt(){ COMPREPLY=($(compgen -W "1 2 3 4 5 6 7 8 9 10 15 20 30 40 50 60 70 80 90 100 120 150 200")) return 0 ;; - -N|--nodegroup) + -N|--nodegroup) MASTER_CONFIG='/etc/salt/master' - COMPREPLY=($(compgen -W "`awk -F ':' 'BEGIN {print_line = 0}; /^nodegroups/ {print_line = 1;getline } print_line && /^ */ {print $1} /^[^ ]/ {print_line = 0}' <${MASTER_CONFIG}`" -- ${cur})) - return 0 + COMPREPLY=($(compgen -W "`awk -F ':' 'BEGIN {print_line = 0}; /^nodegroups/ {print_line = 1;getline } print_line && /^ */ {print $1} /^[^ ]/ {print_line = 0}' <${MASTER_CONFIG}`" -- ${cur})) + return 0 ;; esac @@ -133,8 +133,8 @@ _saltkey(){ prev="${COMP_WORDS[COMP_CWORD-1]}" opts="-c --config-dir= -h --help --version --versions-report -q --quiet \ -y --yes --gen-keys= --gen-keys-dir= --keysize= --key-logfile= \ - -l --list= -L --list-all -a --accept= -A --accept-all \ - -r --reject= -R --reject-all -p --print= -P --print-all \ + -l --list= -L --list-all -a --accept= -A --accept-all \ + -r --reject= -R --reject-all -p --print= -P --print-all \ -d --delete= -D --delete-all -f --finger= -F --finger-all \ --out=pprint --out=yaml --out=overstatestage --out=json --out=raw \ --out=highstate --out=key --out=txt --no-color --out-indent= " @@ -150,13 +150,13 @@ _saltkey(){ fi if [ "${cur}" = "=" ] && [[ "${prev}" == --* ]]; then - cur="" + cur="" fi if [ "${prev}" = "=" ] && [[ "${pprev}" == --* ]]; then prev="${pprev}" fi - case "${prev}" in + case "${prev}" in -a|--accept) COMPREPLY=($(compgen -W "$(salt-key -l un --no-color; salt-key -l rej --no-color)" -- ${cur})) return 0 @@ -177,7 +177,7 @@ _saltkey(){ COMPREPLY=($(compgen -W "2048 3072 4096 5120 6144" -- ${cur})) return 0 ;; - --gen-keys) + --gen-keys) return 0 ;; --gen-keys-dir) @@ -221,14 +221,14 @@ _saltcall(){ COMPREPLY=($(compgen -W "${opts}" -- ${cur})) return 0 fi - + if [ "${cur}" = "=" ] && [[ ${prev} == --* ]]; then cur="" fi if [ "${prev}" = "=" ] && [[ ${pprev} == --* ]]; then prev="${pprev}" fi - + case ${prev} in -m|--module-dirs) COMPREPLY=( $(compgen -d ${cur} )) @@ -262,7 +262,7 @@ _saltcp(){ prev="${COMP_WORDS[COMP_CWORD-1]}" opts="-t --timeout= -s --static -b --batch= --batch-size= \ -h --help --version --versions-report -c --config-dir= \ - -E --pcre -L --list -G --grain --grain-pcre -N --nodegroup \ + -E --pcre -L --list -G --grain --grain-pcre -N --nodegroup \ -R --range -C --compound -I --pillar \ --out=pprint --out=yaml --out=overstatestage --out=json --out=raw \ --out=highstate --out=key --out=txt --no-color --out-indent= " @@ -270,19 +270,19 @@ _saltcp(){ COMPREPLY=($(compgen -W "${opts}" -- ${cur})) return 0 fi - + if [ "${cur}" = "=" ] && [[ "${prev}" == --* ]]; then - cur="" + cur="" fi if [ "${prev}" = "=" ] && [[ "${pprev}" == --* ]]; then prev=${pprev} fi - + case ${prev} in salt-cp) COMPREPLY=($(compgen -W "${opts} `salt-key -l acc --no-color`" -- ${cur})) return 0 - ;; + ;; -t|--timeout) # those numbers are just a hint COMPREPLY=($(compgen -W "2 3 4 8 10 15 20 25 30 40 60 90 120 180 240 300" -- ${cur} )) @@ -303,7 +303,7 @@ _saltcp(){ return 0 ;; -G|--grain|--grain-pcre) - COMPREPLY=($(compgen -W "$(_salt_get_grains)" -- ${cur})) + COMPREPLY=($(compgen -W "$(_salt_get_grains)" -- ${cur})) return 0 ;; # FIXME @@ -320,10 +320,9 @@ _saltcp(){ return 0 ;; esac - + # default is using opts: COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) } complete -F _saltcp salt-cp - diff --git a/completion/available/sqlmap.completion.bash b/completion/available/sqlmap.completion.bash index e80eb796..16addf85 100644 --- a/completion/available/sqlmap.completion.bash +++ b/completion/available/sqlmap.completion.bash @@ -4,7 +4,7 @@ # | # Thanks to Alexander Korznikov | # http://www.korznikov.com/2014/12/bash-tab-completion-for-awesome-tool.html | -# | +# | # ---------------------------------------------------------------------------+ if command -v sqlmap > /dev/null; then @@ -18,7 +18,7 @@ if command -v sqlmap > /dev/null; then prev=$(_get_pword) case $prev in - + # List directory content --tamper) COMPREPLY=( $( compgen -W "$tamper" -- "$cur" ) ) @@ -108,7 +108,7 @@ if command -v sqlmap > /dev/null; then -z --alert --answers --beep --check-waf --cleanup \ --dependencies --disable-coloring --gpage --identify-waf \ --mobile --page-rank --purge-output --smart \ - --sqlmap-shell --wizard' -- "$cur" ) ) + --sqlmap-shell --wizard' -- "$cur" ) ) # this removes any options from the list of completions that have # already been specified somewhere on the command line, as long as # these options can only be used once (in a word, "options", in @@ -155,7 +155,7 @@ if command -v sqlmap > /dev/null; then done printf '%s ' "${COMPREPLY[@]}") <<<"${COMP_WORDS[@]}" ) ) - + # else # _filedir bat fi diff --git a/completion/available/ssh.completion.bash b/completion/available/ssh.completion.bash index 0e066091..1f71f112 100644 --- a/completion/available/ssh.completion.bash +++ b/completion/available/ssh.completion.bash @@ -13,8 +13,8 @@ _sshcomplete() { # parse all defined hosts from .ssh/config and files included there for fl in "$HOME/.ssh/config" \ - $(grep "^\s*Include" "$HOME/.ssh/config" | - awk '{for (i=2; i<=NF; i++) print $i}' | + $(grep "^\s*Include" "$HOME/.ssh/config" | + awk '{for (i=2; i<=NF; i++) print $i}' | sed -Ee "s|^([^/~])|$HOME/.ssh/\1|" -e "s|^~/|$HOME/|") do if [ -r "$fl" ]; then diff --git a/completion/available/virsh.completion.bash b/completion/available/virsh.completion.bash index 14f03d73..4090a24a 100644 --- a/completion/available/virsh.completion.bash +++ b/completion/available/virsh.completion.bash @@ -10,7 +10,7 @@ _contain_cmd() { local e f local array1=($1) array2=($2) - + for e in "${array1[@]}" do for f in "${array2[@]}" @@ -80,7 +80,7 @@ _virsh_list_nwfilters() virsh -q nwfilter-list | cut -d\ -f4 | awk '{print $1}' } -_virsh() +_virsh() { local cur prev cmds doms options nets pools cmds_help local flag_all=1 array ret a b ifaces nwfilters files diff --git a/completion/available/virtualbox.completion.bash b/completion/available/virtualbox.completion.bash index 56e0e673..d0d41df2 100644 --- a/completion/available/virtualbox.completion.bash +++ b/completion/available/virtualbox.completion.bash @@ -23,16 +23,16 @@ __vboxmanage_startvm() { __vboxmanage_list() { INPUT=$(vboxmanage list | tr -s '[\[\]\|\n]' ' ' | cut -d' ' -f4-) - + PRUNED="" if [ "$1" == "long" ]; then for WORD in $INPUT; do [ "$WORD" == "-l" ] && continue; [ "$WORD" == "--long" ] && continue; - + PRUNED="$PRUNED $WORD" done - else + else PRUNED=$INPUT fi @@ -47,7 +47,7 @@ __vboxmanage_list_vms() { else SEPARATOR=$1 fi - + for VM in $(vboxmanage list vms | cut -d' ' -f1 | tr -d '"'); do [ "$VMS" != "" ] && VMS="${VMS}${SEPARATOR}" VMS="${VMS}${VM}" @@ -63,7 +63,7 @@ __vboxmanage_list_runningvms() { else SEPARATOR=$1 fi - + for VM in $(vboxmanage list runningvms | cut -d' ' -f1 | tr -d '"'); do [ "$VMS" != "" ] && VMS="${VMS}${SEPARATOR}" VMS="${VMS}${VM}" @@ -81,7 +81,7 @@ __vboxmanage_controlvm() { echo "screenshotpng setcredentials teleport plugcpu unplugcpu" echo "cpuexecutioncap" -# setlinkstate<1-N> +# setlinkstate<1-N> # nic<1-N> null|nat|bridged|intnet|hostonly|generic # [] | # nictrace<1-N> on|off @@ -136,9 +136,9 @@ __vboxmanage_default() { done (( $MATCH == 1 )) && continue; pruned="$pruned $WORD" - + done - + # COMPREPLY=($(compgen -W "${pruned}" -- ${cur})) echo $pruned return 0 @@ -156,13 +156,13 @@ _vboxmanage() { # In case current is complete command case $cur in - startvm|list|controlvm) + startvm|list|controlvm) COMPREPLY=($(compgen -W "$cur ")) return 0 ;; esac - case $prev in + case $prev in -v|--version) return 0 ;; @@ -170,13 +170,13 @@ _vboxmanage() { -l|--long) opts=$(__vboxmanage_list "long") COMPREPLY=($(compgen -W "${opts}" -- ${cur})) - return 0 + return 0 ;; startvm|list) opts=$(__vboxmanage_$prev) COMPREPLY=($(compgen -W "${opts}" -- ${cur})) - return 0 - ;; + return 0 + ;; --type) COMPREPLY=($(compgen -W "gui headless" -- ${cur})) return 0 @@ -204,7 +204,7 @@ _vboxmanage() { # echo "previous: $pprev" case $pprev in startvm) - opts="--type" + opts="--type" COMPREPLY=($(compgen -W "${opts}" -- ${cur})) return 0 ;; diff --git a/completion/available/vuejs.completion.bash b/completion/available/vuejs.completion.bash index 2959f29b..69794785 100644 --- a/completion/available/vuejs.completion.bash +++ b/completion/available/vuejs.completion.bash @@ -10,6 +10,6 @@ if command -v vue > /dev/null; then fi done } - + complete -F __vuejs_completion vue fi diff --git a/completion/available/wpscan.completion.bash b/completion/available/wpscan.completion.bash index 3630183e..f9ea5790 100644 --- a/completion/available/wpscan.completion.bash +++ b/completion/available/wpscan.completion.bash @@ -10,7 +10,6 @@ if command -v wpscan > /dev/null; then fi done } - + complete -F __wpscan_completion wpscan fi - diff --git a/plugins/available/autojump.plugin.bash b/plugins/available/autojump.plugin.bash index a050ace2..345ecadb 100644 --- a/plugins/available/autojump.plugin.bash +++ b/plugins/available/autojump.plugin.bash @@ -8,5 +8,5 @@ if command -v brew &>/dev/null && [[ -s $(brew --prefix)/etc/profile.d/autojump. elif command -v dpkg &>/dev/null && dpkg -s autojump &>/dev/null ; then . "$(dpkg-query -S autojump.sh | cut -d' ' -f2)" elif command -v pacman &>/dev/null && pacman -Q autojump &>/dev/null ; then - . "$(pacman -Ql autojump | grep autojump.sh | cut -d' ' -f2)" + . "$(pacman -Ql autojump | grep autojump.sh | cut -d' ' -f2)" fi diff --git a/plugins/available/git.plugin.bash b/plugins/available/git.plugin.bash index d5aa6d8f..b2c05b60 100644 --- a/plugins/available/git.plugin.bash +++ b/plugins/available/git.plugin.bash @@ -227,7 +227,7 @@ function gitignore-reload() { example '$ gitignore-reload' # The .gitignore file should not be reloaded if there are uncommited changes. - # Firstly, require a clean work tree. The function require_clean_work_tree() + # Firstly, require a clean work tree. The function require_clean_work_tree() # was stolen with love from https://www.spinics.net/lists/git/msg142043.html # Begin require_clean_work_tree() @@ -273,5 +273,3 @@ function gitignore-reload() { echo >&2 "Files readded. Commit your new changes now." fi } - - diff --git a/plugins/available/postgres.plugin.bash b/plugins/available/postgres.plugin.bash index e481d734..8f239985 100644 --- a/plugins/available/postgres.plugin.bash +++ b/plugins/available/postgres.plugin.bash @@ -11,7 +11,7 @@ do if [ -f "$possible/pg_hba.conf" ] then # echo "PGDATA: $possible" - export PGDATA=$possible + export PGDATA=$possible fi done @@ -23,7 +23,7 @@ function postgres_start { about 'Starts PostgreSQL server' group 'postgres' - echo 'Starting Postgres....'; + echo 'Starting Postgres....'; $POSTGRES_BIN/pg_ctl -D $PGDATA -l $PGDATA/logfile start } @@ -31,7 +31,7 @@ function postgres_stop { about 'Stops PostgreSQL server' group 'postgres' - echo 'Stopping Postgres....'; + echo 'Stopping Postgres....'; $POSTGRES_BIN/pg_ctl -D $PGDATA -l $PGDATA/logfile stop -s -m fast } @@ -39,7 +39,7 @@ function postgres_status { about 'Returns status of PostgreSQL server' group 'postgres' - # $POSTGRES_BIN/pg_ctl -D $PGDATA status + # $POSTGRES_BIN/pg_ctl -D $PGDATA status if [[ $(is_postgres_running) == "no server running" ]] then echo "Postgres service [STOPPED]" @@ -58,7 +58,7 @@ function postgres_restart { about 'Restarts status of PostgreSQL server' group 'postgres' - echo 'Restarting Postgres....'; + echo 'Restarting Postgres....'; $POSTGRES_BIN/pg_ctl -D $PGDATA restart } @@ -84,4 +84,3 @@ function postgres_serverlog { # tail -500 $PGDATA/pg_log/`ls -Art $PGDATA/pg_log | tail -n 1` | less # } # - diff --git a/plugins/available/powerline.plugin.bash b/plugins/available/powerline.plugin.bash index 0388aa37..3d91e658 100644 --- a/plugins/available/powerline.plugin.bash +++ b/plugins/available/powerline.plugin.bash @@ -22,5 +22,5 @@ bashPowerlineInit=$(python -c \ 'bindings', \ 'bash', \ 'powerline.sh'))") -[ -e $bashPowerlineInit ] || return +[ -e $bashPowerlineInit ] || return . $bashPowerlineInit diff --git a/themes/atomic/atomic.theme.bash b/themes/atomic/atomic.theme.bash index 5f44b34b..5035d49f 100644 --- a/themes/atomic/atomic.theme.bash +++ b/themes/atomic/atomic.theme.bash @@ -73,24 +73,24 @@ ____atomic_top() { _TOP_RIGHT="" __TOP_RIGHT_LEN=0 __SEG_AT_RIGHT=0 - + for seg in ${___ATOMIC_TOP_LEFT}; do info="$(___atomic_prompt_"${seg}")" [ -n "${info}" ] && ____atomic_top_left_parse "${info}" done - + ___cursor_right="\e[500C" _TOP_LEFT+="${___cursor_right}" - + for seg in ${___ATOMIC_TOP_RIGHT}; do info="$(___atomic_prompt_"${seg}")" [ -n "${info}" ] && ____atomic_top_right_parse "${info}" done - + [ $__TOP_RIGHT_LEN -gt 0 ] && __TOP_RIGHT_LEN=$(( __TOP_RIGHT_LEN - 0 )) ___cursor_adjust="\e[${__TOP_RIGHT_LEN}D" _TOP_LEFT+="${___cursor_adjust}" - + printf "%s%s" "${_TOP_LEFT}" "${_TOP_RIGHT}" } @@ -111,7 +111,7 @@ ___atomic_prompt_user_info() { color=$white box="${normal}${LineA}\$([[ \$? != 0 ]] && echo \"${BIWhite}[${IRed}${SX}${BIWhite}]${normal}${Line}\")${Line}${BIWhite}[|${BIWhite}]${normal}${Line}" info="${IYellow}\u${IRed}@${IGreen}\h" - + printf "%s|%s|%s|%s" "${color}" "${info}" "${white}" "${box}" } @@ -234,7 +234,7 @@ _atomic_completion() { return 0 ;; esac - + COMPREPLY=( $(compgen -W "${actions}" -- "${cur}") ) return 0 } @@ -312,7 +312,7 @@ __atomic_ps2() { _atomic_prompt() { exitcode="$?" - + PS1="$(__atomic_ps1)" PS2="$(__atomic_ps2)" } diff --git a/themes/barbuk/README.md b/themes/barbuk/README.md index fdc60719..cfff155f 100644 --- a/themes/barbuk/README.md +++ b/themes/barbuk/README.md @@ -84,7 +84,7 @@ chmod 400 /etc/sudoers.d/keepenv ### Clean ```bash - ~ ❯ + ~ ❯ ``` ### Git diff --git a/themes/codeword/README.md b/themes/codeword/README.md index 38201dbf..c0cb8944 100644 --- a/themes/codeword/README.md +++ b/themes/codeword/README.md @@ -4,7 +4,7 @@ Minimal theme overrides from bash_it base theming -## `user@host:path[virt-env][scm] $` +## `user@host:path[virt-env][scm] $` Breakdown of the segments: - **user@host:path** - *convienient for LAN based `ssh` and `scp` tasks* diff --git a/themes/essential/essential.theme.bash b/themes/essential/essential.theme.bash index c0b1a38e..ae988733 100644 --- a/themes/essential/essential.theme.bash +++ b/themes/essential/essential.theme.bash @@ -54,7 +54,7 @@ function _exit-status-prompt() { local -r exit_status_color="${bold_red}" fi - echo -ne "${exit_status_color}" + echo -ne "${exit_status_color}" if [[ "${prompt_string}" -eq 1 ]]; then # $PS1: echo -e " +${normal} " diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index eaa6b1eb..404088d9 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# This theme was obviously inspired a lot by +# This theme was obviously inspired a lot by # # - Demula theme # @@ -17,8 +17,8 @@ # - configurable directory length # - hg, svn, git detection (I work in all of them) # - virtualenv, rvm + gemsets -# -# Screenshot: http://i.imgur.com/4IAMJ.png +# +# Screenshot: http://i.imgur.com/4IAMJ.png # # by Ryan Kanno # @@ -26,7 +26,7 @@ # # Note: I also am really new to this bash scripting game, so if you see things # that are flat out wrong, or if you think of something neat, just send a pull -# request. This probably only works on a Mac - as some functions are OS +# request. This probably only works on a Mac - as some functions are OS # specific like getting ip, etc. # @@ -88,11 +88,11 @@ function get_ip_info { echo -e "$(ips | sed -e :a -e '$!N;s/\n/${IP_SEPARATOR}/;ta' | sed -e 's/127\.0\.0\.1\${IP_SEPARATOR}//g'), ${myip}" } -# Displays ip prompt +# Displays ip prompt function ip_prompt_info() { if [[ $IP_ENABLED == 1 ]]; then echo -e " ${DEFAULT_COLOR}(${IP_COLOR}$(get_ip_info)${DEFAULT_COLOR})" - fi + fi } # Displays virtual info prompt (virtualenv/rvm) @@ -165,10 +165,10 @@ function svn_prompt_info() { echo -e "$prefix${REF_COLOR}$ref${DEFAULT_COLOR}:$revision$state$suffix" } -# Displays last X characters of pwd +# Displays last X characters of pwd function limited_pwd() { - # Replace $HOME with ~ if possible + # Replace $HOME with ~ if possible RELATIVE_PWD=${PWD/#$HOME/\~} local offset=$((${#RELATIVE_PWD}-$MAX_PWD_LENGTH)) diff --git a/themes/n0qorg/n0qorg.theme.bash b/themes/n0qorg/n0qorg.theme.bash index 291e4518..12952913 100644 --- a/themes/n0qorg/n0qorg.theme.bash +++ b/themes/n0qorg/n0qorg.theme.bash @@ -19,7 +19,7 @@ GIT_THEME_PROMPT_PREFIX="${bold_blue}(${bold_white}" GIT_THEME_PROMPT_SUFFIX="${bold_blue})" ## alternate chars -# +# SCM_THEME_PROMPT_DIRTY="*" SCM_THEME_PROMPT_CLEAN="" SCM_THEME_PROMPT_PREFIX="(" diff --git a/themes/parrot/parrot.theme.bash b/themes/parrot/parrot.theme.bash index afc8dd53..815aa952 100644 --- a/themes/parrot/parrot.theme.bash +++ b/themes/parrot/parrot.theme.bash @@ -28,7 +28,7 @@ function prompt() { if [ "$color_prompt" = yes ]; then PS1="\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]root\[\033[01;33m\]@\[\033[01;96m\]\h'; else echo '\[\033[0;39m\]\u\[\033[01;33m\]@\[\033[01;96m\]\h'; fi)\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]$(parse_git_branch) $\[\e[0m\] " - + else PS1='┌──[\u@\h]─[\w]\n└──╼ $(parse_git_branch_no_color) $ ' fi diff --git a/themes/powerline-multiline/README.md b/themes/powerline-multiline/README.md index f4a1fab8..da66d4ef 100644 --- a/themes/powerline-multiline/README.md +++ b/themes/powerline-multiline/README.md @@ -66,7 +66,7 @@ The contents of both prompt sides can be "reordered", all the "segments" (every and `conda` supported) * `ruby` - Current ruby version if using `rvm` * `node` - Current node version (only `nvm` is supported) -* `scm` - Version control information, `git` +* `scm` - Version control information, `git` * `terraform` - Current terraform workspace * `user_info` - Current user * `wd` - Working directory, like `cwd` but doesn't show the full folder diff --git a/themes/pure/pure.theme.bash b/themes/pure/pure.theme.bash index c18e20b2..0be40b5a 100644 --- a/themes/pure/pure.theme.bash +++ b/themes/pure/pure.theme.bash @@ -17,13 +17,13 @@ VIRTUALENV_THEME_PROMPT_SUFFIX=")" # export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' scm_prompt() { - CHAR=$(scm_char) - if [ $CHAR = $SCM_NONE_CHAR ] - then + CHAR=$(scm_char) + if [ $CHAR = $SCM_NONE_CHAR ] + then return - else + else echo "[$(scm_char)$(scm_prompt_info)]" - fi + fi } pure_prompt() { diff --git a/themes/ramses/ramses.theme.bash b/themes/ramses/ramses.theme.bash index 83ab810f..7795cf75 100644 --- a/themes/ramses/ramses.theme.bash +++ b/themes/ramses/ramses.theme.bash @@ -49,7 +49,7 @@ modern_scm_prompt() { # show chroot if exist chroot(){ if [ -n "$debian_chroot" ] - then + then my_ps_chroot="${bold_cyan}$debian_chroot${normal}"; echo "($my_ps_chroot)"; fi @@ -63,7 +63,7 @@ my_ve(){ my_ps_ve="${bold_purple}${CONDA_DEFAULT_ENV}${normal}"; echo "($my_ps_ve)"; elif [ -n "$VIRTUAL_ENV" ] - then + then my_ps_ve="${bold_purple}$ve${normal}"; echo "($my_ps_ve)"; fi @@ -75,7 +75,7 @@ prompt() { my_ps_host="${green}\h${normal}"; # yes, these are the the same for now ... my_ps_host_root="${green}\h${normal}"; - + my_ps_user="${bold_green}\u${normal}" my_ps_root="${bold_red}\u${normal}"; diff --git a/themes/sirup/sirup.theme.bash b/themes/sirup/sirup.theme.bash index 38fcab41..235de018 100644 --- a/themes/sirup/sirup.theme.bash +++ b/themes/sirup/sirup.theme.bash @@ -13,7 +13,7 @@ function rvm_version_prompt { [ "$full" != "" ] && echo "$full" } - + function prompt_command() { # Check http://github.com/Sirupsen/dotfiles for screenshot PS1="$blue\W/$bold_blue$(rvm_version_prompt)$bold_green$(__git_ps1 " (%s)") ${normal}$ " diff --git a/themes/zork/zork.theme.bash b/themes/zork/zork.theme.bash index 905d655b..b5872314 100644 --- a/themes/zork/zork.theme.bash +++ b/themes/zork/zork.theme.bash @@ -49,7 +49,7 @@ modern_scm_prompt() { # show chroot if exist chroot(){ if [ -n "$debian_chroot" ] - then + then my_ps_chroot="${bold_cyan}$debian_chroot${normal}"; echo "($my_ps_chroot)"; fi @@ -63,7 +63,7 @@ my_ve(){ my_ps_ve="${bold_purple}${CONDA_DEFAULT_ENV}${normal}"; echo "($my_ps_ve)"; elif [ -n "$VIRTUAL_ENV" ] - then + then my_ps_ve="${bold_purple}$ve${normal}"; echo "($my_ps_ve)"; fi @@ -75,7 +75,7 @@ prompt() { my_ps_host="${green}\h${normal}"; # yes, these are the the same for now ... my_ps_host_root="${green}\h${normal}"; - + my_ps_user="${bold_green}\u${normal}" my_ps_root="${bold_red}\u${normal}"; From 3a1283dad5c423bdd8ef0920e83fb681632c7cb5 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Tue, 10 Mar 2020 10:18:11 +0200 Subject: [PATCH 16/68] Fix EOF --- aliases/available/fuck.aliases.bash | 1 - aliases/available/node.aliases.bash | 1 - aliases/available/puppet.aliases.bash | 1 - completion/available/consul.completion.bash | 2 +- completion/available/django.completion.bash | 1 - completion/available/docker-compose.completion.bash | 2 +- completion/available/docker-machine.completion.bash | 2 +- completion/available/homesick.completion.bash | 1 - completion/available/invoke.completion.bash | 1 - completion/available/maven.completion.bash | 2 +- completion/available/ng.completion.bash | 1 - completion/available/packer.completion.bash | 1 - completion/available/pip3.completion.bash | 1 - completion/available/projects.completion.bash | 1 - completion/available/test_kitchen.completion.bash | 1 - completion/available/tmux.completion.bash | 1 - plugins/available/explain.plugin.bash | 1 - plugins/available/gradle.plugin.bash | 1 - plugins/available/man.plugin.bash | 2 +- plugins/available/sdkman.plugin.bash | 1 - themes/gitline/powerline.base.bash | 1 - themes/liquidprompt/.gitignore | 1 - themes/mbriggs/mbriggs.theme.bash | 2 +- themes/nwinkler_random_colors/README.md | 1 - themes/powerline/powerline.base.bash | 1 - themes/powerturk/powerturk.theme.bash | 1 - 26 files changed, 6 insertions(+), 26 deletions(-) diff --git a/aliases/available/fuck.aliases.bash b/aliases/available/fuck.aliases.bash index 959807fb..495ea851 100644 --- a/aliases/available/fuck.aliases.bash +++ b/aliases/available/fuck.aliases.bash @@ -8,4 +8,3 @@ fi alias please=fuck alias plz=please alias fucking=sudo - diff --git a/aliases/available/node.aliases.bash b/aliases/available/node.aliases.bash index ddf3c92c..a1408f26 100644 --- a/aliases/available/node.aliases.bash +++ b/aliases/available/node.aliases.bash @@ -6,4 +6,3 @@ alias node-dev='export NODE_ENV=development' # alias to setup nodejs production environment alias node-prod='export NODE_ENV=production' - diff --git a/aliases/available/puppet.aliases.bash b/aliases/available/puppet.aliases.bash index bb5b4a1a..15b69923 100644 --- a/aliases/available/puppet.aliases.bash +++ b/aliases/available/puppet.aliases.bash @@ -7,4 +7,3 @@ alias puplint="puppet-lint *.pp" alias pupagt="puppet agent -t" alias pupagtd="puppet agent -t --debug" alias pupapp="puppet apply" - diff --git a/completion/available/consul.completion.bash b/completion/available/consul.completion.bash index 2082e344..0180ba2d 100644 --- a/completion/available/consul.completion.bash +++ b/completion/available/consul.completion.bash @@ -7,4 +7,4 @@ then complete -C "$CONSUL_BIN" consul fi -unset CONSUL_BIN \ No newline at end of file +unset CONSUL_BIN diff --git a/completion/available/django.completion.bash b/completion/available/django.completion.bash index 1c3887eb..aca13ce4 100644 --- a/completion/available/django.completion.bash +++ b/completion/available/django.completion.bash @@ -69,4 +69,3 @@ else fi complete -F _python_django_completion -o default $pythons - diff --git a/completion/available/docker-compose.completion.bash b/completion/available/docker-compose.completion.bash index dedd8e31..941f25a3 100644 --- a/completion/available/docker-compose.completion.bash +++ b/completion/available/docker-compose.completion.bash @@ -670,4 +670,4 @@ _docker_compose() { eval "$__docker_compose_previous_extglob_setting" unset __docker_compose_previous_extglob_setting -complete -F _docker_compose docker-compose docker-compose.exe \ No newline at end of file +complete -F _docker_compose docker-compose docker-compose.exe diff --git a/completion/available/docker-machine.completion.bash b/completion/available/docker-machine.completion.bash index 8c692ff6..07d39d1e 100644 --- a/completion/available/docker-machine.completion.bash +++ b/completion/available/docker-machine.completion.bash @@ -413,4 +413,4 @@ _docker_machine() { return 0 } -complete -F _docker_machine docker-machine docker-machine.exe \ No newline at end of file +complete -F _docker_machine docker-machine docker-machine.exe diff --git a/completion/available/homesick.completion.bash b/completion/available/homesick.completion.bash index d0ebbba4..31104f5b 100644 --- a/completion/available/homesick.completion.bash +++ b/completion/available/homesick.completion.bash @@ -57,4 +57,3 @@ _homesick_complete() } complete -o bashdefault -o default -F _homesick_complete homesick - diff --git a/completion/available/invoke.completion.bash b/completion/available/invoke.completion.bash index f062bcab..f90097f2 100644 --- a/completion/available/invoke.completion.bash +++ b/completion/available/invoke.completion.bash @@ -28,4 +28,3 @@ _complete_invoke() { # * -o default: when function generates no results, use filenames. # * positional args: program names to complete for. complete -F _complete_invoke -o default invoke inv - diff --git a/completion/available/maven.completion.bash b/completion/available/maven.completion.bash index 75892f13..31216449 100644 --- a/completion/available/maven.completion.bash +++ b/completion/available/maven.completion.bash @@ -33,4 +33,4 @@ _mvn() return 0 } && -complete -F _mvn mvn \ No newline at end of file +complete -F _mvn mvn diff --git a/completion/available/ng.completion.bash b/completion/available/ng.completion.bash index 827bc22d..f219b303 100644 --- a/completion/available/ng.completion.bash +++ b/completion/available/ng.completion.bash @@ -1,4 +1,3 @@ - if _command_exists ng; then # No longer supported, please see https://github.com/angular/angular-cli/issues/11043 # Fix courtesy of https://stackoverflow.com/questions/50194674/ng-completion-no-longer-exists diff --git a/completion/available/packer.completion.bash b/completion/available/packer.completion.bash index 99c221ea..fb940c9b 100644 --- a/completion/available/packer.completion.bash +++ b/completion/available/packer.completion.bash @@ -161,4 +161,3 @@ _packer_completion () } complete -o nospace -F _packer_completion packer - diff --git a/completion/available/pip3.completion.bash b/completion/available/pip3.completion.bash index 599e96e5..1e2ffb42 100644 --- a/completion/available/pip3.completion.bash +++ b/completion/available/pip3.completion.bash @@ -8,4 +8,3 @@ if command -v pip3 >/dev/null; then eval "$(pip3 completion --bash)" fi - diff --git a/completion/available/projects.completion.bash b/completion/available/projects.completion.bash index 4d148704..90735ee1 100644 --- a/completion/available/projects.completion.bash +++ b/completion/available/projects.completion.bash @@ -44,4 +44,3 @@ _pj() { complete -F _pj -o nospace pj complete -F _pj -o nospace pjo - diff --git a/completion/available/test_kitchen.completion.bash b/completion/available/test_kitchen.completion.bash index 2420aab0..25459981 100644 --- a/completion/available/test_kitchen.completion.bash +++ b/completion/available/test_kitchen.completion.bash @@ -28,4 +28,3 @@ __kitchen_options () { esac } complete -F __kitchen_options kitchen - diff --git a/completion/available/tmux.completion.bash b/completion/available/tmux.completion.bash index ddadcbd8..6bb8293f 100644 --- a/completion/available/tmux.completion.bash +++ b/completion/available/tmux.completion.bash @@ -185,4 +185,3 @@ _tmux() { complete -F _tmux tmux # END tmux completion - diff --git a/plugins/available/explain.plugin.bash b/plugins/available/explain.plugin.bash index 1fb38bdd..ab7b4a0c 100644 --- a/plugins/available/explain.plugin.bash +++ b/plugins/available/explain.plugin.bash @@ -21,4 +21,3 @@ explain () { echo "explain 'cmd -o | ...' one quoted command to explain it." fi } - diff --git a/plugins/available/gradle.plugin.bash b/plugins/available/gradle.plugin.bash index 387f5fd5..6267bd84 100644 --- a/plugins/available/gradle.plugin.bash +++ b/plugins/available/gradle.plugin.bash @@ -19,4 +19,3 @@ function gw() { # Call gradle "${result}" $* } - diff --git a/plugins/available/man.plugin.bash b/plugins/available/man.plugin.bash index 438779f0..473f04fd 100644 --- a/plugins/available/man.plugin.bash +++ b/plugins/available/man.plugin.bash @@ -7,4 +7,4 @@ export LESS_TERMCAP_me=$'\e[0m' export LESS_TERMCAP_se=$'\e[0m' export LESS_TERMCAP_so=$'\e[01;33m' export LESS_TERMCAP_ue=$'\e[0m' -export LESS_TERMCAP_us=$'\e[1;4;31m' \ No newline at end of file +export LESS_TERMCAP_us=$'\e[1;4;31m' diff --git a/plugins/available/sdkman.plugin.bash b/plugins/available/sdkman.plugin.bash index 072fbbb3..a4048c11 100644 --- a/plugins/available/sdkman.plugin.bash +++ b/plugins/available/sdkman.plugin.bash @@ -6,4 +6,3 @@ about-plugin 'Load Software Development Kit Manager' export SDKMAN_DIR=${SDKMAN_DIR:-$HOME/.sdkman} [[ -s "${SDKMAN_DIR}/bin/sdkman-init.sh" ]] && source "${SDKMAN_DIR}/bin/sdkman-init.sh" - diff --git a/themes/gitline/powerline.base.bash b/themes/gitline/powerline.base.bash index 45387b02..0f8a3028 100644 --- a/themes/gitline/powerline.base.bash +++ b/themes/gitline/powerline.base.bash @@ -225,4 +225,3 @@ function __powerline_prompt_command { LEFT_PROMPT \ SEGMENTS_AT_LEFT } - diff --git a/themes/liquidprompt/.gitignore b/themes/liquidprompt/.gitignore index a8144dd5..760c6d6f 100644 --- a/themes/liquidprompt/.gitignore +++ b/themes/liquidprompt/.gitignore @@ -1,2 +1 @@ liquidprompt - diff --git a/themes/mbriggs/mbriggs.theme.bash b/themes/mbriggs/mbriggs.theme.bash index 169f8d7c..697fe026 100644 --- a/themes/mbriggs/mbriggs.theme.bash +++ b/themes/mbriggs/mbriggs.theme.bash @@ -31,4 +31,4 @@ function prompt() { PS1="\n${n_commands} ${user_host} ${prompt_symbol} ${ruby} ${open}${current_path}${git_branch}${close}${return_status}\n${prompt_char}" } -safe_append_prompt_command prompt \ No newline at end of file +safe_append_prompt_command prompt diff --git a/themes/nwinkler_random_colors/README.md b/themes/nwinkler_random_colors/README.md index 80620efb..69bfcd69 100644 --- a/themes/nwinkler_random_colors/README.md +++ b/themes/nwinkler_random_colors/README.md @@ -26,4 +26,3 @@ Here it is in action: ## Usage Scenario This theme is especially useful when connecting to many different machines and switching between them often. Yes, the hostname *is* present in the prompt. But I argue that it's a lot faster to get a "feel" of what machine you are currently on because of the custom colors on that machine's prompt than by reading the hostname. - diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index 8c983a7b..3655e851 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -280,4 +280,3 @@ function __powerline_prompt_command { LEFT_PROMPT \ SEGMENTS_AT_LEFT } - diff --git a/themes/powerturk/powerturk.theme.bash b/themes/powerturk/powerturk.theme.bash index 35404360..4590a8aa 100644 --- a/themes/powerturk/powerturk.theme.bash +++ b/themes/powerturk/powerturk.theme.bash @@ -182,4 +182,3 @@ function powerline_prompt_command() { } PROMPT_COMMAND=powerline_prompt_command - From 81f7af5036cd633d4e585b74ac6d887007c60b32 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Tue, 10 Mar 2020 10:37:07 +0200 Subject: [PATCH 17/68] In case we ARE committing to tabs now... --- .editorconfig | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.editorconfig b/.editorconfig index e302645a..18a9fca0 100755 --- a/.editorconfig +++ b/.editorconfig @@ -1,15 +1,36 @@ # EditorConfig is awesome: http://EditorConfig.org [*] -indent_style = space -indent_size = 2 -end_of_line = lf -charset = utf-8 +indent_style = tab +indent_size = 1 + +shell_variant = bash +binary_next_line = true # like -bn +switch_case_indent = true # like -ci +space_redirects = true # like -sr +keep_padding = true # like -kp +end_of_line = lf +charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace = false + [.git*] indent_style = tab + +[*.*sh] +indent_style = tab +indent_size = 1 + +shell_variant = bash +binary_next_line = true # like -bn +switch_case_indent = true # like -ci +space_redirects = true # like -sr +keep_padding = true # like -kp +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true From eca68db8ccc2f980a5dbfcc2d0d965ced95ad1c2 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Wed, 25 Mar 2020 09:42:17 +0200 Subject: [PATCH 18/68] Fixing the indent to everyone's content --- .editorconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index 18a9fca0..5a376252 100755 --- a/.editorconfig +++ b/.editorconfig @@ -2,7 +2,7 @@ [*] indent_style = tab -indent_size = 1 +indent_size = 4 shell_variant = bash binary_next_line = true # like -bn @@ -23,7 +23,7 @@ indent_style = tab [*.*sh] indent_style = tab -indent_size = 1 +indent_size = 4 shell_variant = bash binary_next_line = true # like -bn From 507e4bec82e3cc40c6bc3488b0bdf387acdfc49e Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sun, 21 Jun 2020 16:03:18 +0300 Subject: [PATCH 19/68] Convert files with spaces and tabs to only spaces --- completion/available/salt.completion.bash | 116 +++++----- .../available/virtualbox.completion.bash | 208 +++++++++--------- themes/parrot/parrot.theme.bash | 4 +- 3 files changed, 164 insertions(+), 164 deletions(-) diff --git a/completion/available/salt.completion.bash b/completion/available/salt.completion.bash index 7634dcdc..de493af9 100644 --- a/completion/available/salt.completion.bash +++ b/completion/available/salt.completion.bash @@ -35,10 +35,10 @@ _salt(){ cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" if [ ${COMP_CWORD} -gt 2 ]; then - pprev="${COMP_WORDS[COMP_CWORD-2]}" + pprev="${COMP_WORDS[COMP_CWORD-2]}" fi if [ ${COMP_CWORD} -gt 3 ]; then - ppprev="${COMP_WORDS[COMP_CWORD-3]}" + ppprev="${COMP_WORDS[COMP_CWORD-3]}" fi opts="-h --help -d --doc --documentation --version --versions-report -c \ @@ -96,7 +96,7 @@ _salt(){ -G|--grain|--grain-pcre) COMPREPLY=($(compgen -W "$(_salt_get_grains)" -- ${cur})) return 0 - ;; + ;; -C|--compound) COMPREPLY=() # TODO: finish this one? how? return 0 @@ -110,7 +110,7 @@ _salt(){ return 0 ;; -N|--nodegroup) - MASTER_CONFIG='/etc/salt/master' + MASTER_CONFIG='/etc/salt/master' COMPREPLY=($(compgen -W "`awk -F ':' 'BEGIN {print_line = 0}; /^nodegroups/ {print_line = 1;getline } print_line && /^ */ {print $1} /^[^ ]/ {print_line = 0}' <${MASTER_CONFIG}`" -- ${cur})) return 0 ;; @@ -193,7 +193,7 @@ _saltkey(){ return 0 ;; --accept-all) - return 0 + return 0 ;; esac COMPREPLY=($(compgen -W "${opts} " -- ${cur})) @@ -230,21 +230,21 @@ _saltcall(){ fi case ${prev} in - -m|--module-dirs) - COMPREPLY=( $(compgen -d ${cur} )) - return 0 - ;; - -l|--log-level) - COMPREPLY=( $(compgen -W "info none garbage trace warning error debug" -- ${cur})) - return 0 - ;; - -g|grains) - return 0 - ;; - salt-call) - COMPREPLY=($(compgen -W "${opts}" -- ${cur})) - return 0 - ;; + -m|--module-dirs) + COMPREPLY=( $(compgen -d ${cur} )) + return 0 + ;; + -l|--log-level) + COMPREPLY=( $(compgen -W "info none garbage trace warning error debug" -- ${cur})) + return 0 + ;; + -g|grains) + return 0 + ;; + salt-call) + COMPREPLY=($(compgen -W "${opts}" -- ${cur})) + return 0 + ;; esac _salt_coms="$(salt-call --out=txt -- sys.list_functions|sed 's/^.*\[//' | tr -d ",']" )" @@ -279,46 +279,46 @@ _saltcp(){ fi case ${prev} in - salt-cp) - COMPREPLY=($(compgen -W "${opts} `salt-key -l acc --no-color`" -- ${cur})) - return 0 - ;; - -t|--timeout) - # those numbers are just a hint - COMPREPLY=($(compgen -W "2 3 4 8 10 15 20 25 30 40 60 90 120 180 240 300" -- ${cur} )) - return 0 - ;; - -E|--pcre) - COMPREPLY=($(compgen -W "`salt-key -l acc --no-color`" -- ${cur})) - return 0 - ;; - -L|--list) - # IMPROVEMENTS ARE WELCOME - prefpart="${cur%,*}," - postpart=${cur##*,} - filt="^\($(echo ${cur}| sed 's:,:\\|:g')\)$" + salt-cp) + COMPREPLY=($(compgen -W "${opts} `salt-key -l acc --no-color`" -- ${cur})) + return 0 + ;; + -t|--timeout) + # those numbers are just a hint + COMPREPLY=($(compgen -W "2 3 4 8 10 15 20 25 30 40 60 90 120 180 240 300" -- ${cur} )) + return 0 + ;; + -E|--pcre) + COMPREPLY=($(compgen -W "`salt-key -l acc --no-color`" -- ${cur})) + return 0 + ;; + -L|--list) + # IMPROVEMENTS ARE WELCOME + prefpart="${cur%,*}," + postpart=${cur##*,} + filt="^\($(echo ${cur}| sed 's:,:\\|:g')\)$" helper=($(salt-key -l acc --no-color | grep -v "${filt}" | sed "s/^/${prefpart}/")) - COMPREPLY=($(compgen -W "${helper[*]}" -- ${cur})) + COMPREPLY=($(compgen -W "${helper[*]}" -- ${cur})) - return 0 - ;; - -G|--grain|--grain-pcre) - COMPREPLY=($(compgen -W "$(_salt_get_grains)" -- ${cur})) - return 0 - ;; - # FIXME - -R|--range) - # FIXME ?? - return 0 - ;; - -C|--compound) - # FIXME ?? - return 0 - ;; - -c|--config) - COMPREPLY=($(compgen -f -- ${cur})) - return 0 - ;; + return 0 + ;; + -G|--grain|--grain-pcre) + COMPREPLY=($(compgen -W "$(_salt_get_grains)" -- ${cur})) + return 0 + ;; + # FIXME + -R|--range) + # FIXME ?? + return 0 + ;; + -C|--compound) + # FIXME ?? + return 0 + ;; + -c|--config) + COMPREPLY=($(compgen -f -- ${cur})) + return 0 + ;; esac # default is using opts: diff --git a/completion/available/virtualbox.completion.bash b/completion/available/virtualbox.completion.bash index d0d41df2..3c29437f 100644 --- a/completion/available/virtualbox.completion.bash +++ b/completion/available/virtualbox.completion.bash @@ -10,13 +10,13 @@ __vboxmanage_startvm() { AVAILABLE="" for VM in $TOTAL; do - MATCH=0; - for RUN in $RUNNING "x"; do - if [ "$VM" == "$RUN" ]; then - MATCH=1 - fi - done - (( $MATCH == 0 )) && AVAILABLE="$AVAILABLE $VM " + MATCH=0; + for RUN in $RUNNING "x"; do + if [ "$VM" == "$RUN" ]; then + MATCH=1 + fi + done + (( $MATCH == 0 )) && AVAILABLE="$AVAILABLE $VM " done echo $AVAILABLE } @@ -26,14 +26,14 @@ __vboxmanage_list() { PRUNED="" if [ "$1" == "long" ]; then - for WORD in $INPUT; do - [ "$WORD" == "-l" ] && continue; - [ "$WORD" == "--long" ] && continue; + for WORD in $INPUT; do + [ "$WORD" == "-l" ] && continue; + [ "$WORD" == "--long" ] && continue; - PRUNED="$PRUNED $WORD" - done + PRUNED="$PRUNED $WORD" + done else - PRUNED=$INPUT + PRUNED=$INPUT fi echo $PRUNED @@ -43,14 +43,14 @@ __vboxmanage_list() { __vboxmanage_list_vms() { VMS="" if [ "x$1" == "x" ]; then - SEPARATOR=" " + SEPARATOR=" " else - SEPARATOR=$1 + SEPARATOR=$1 fi for VM in $(vboxmanage list vms | cut -d' ' -f1 | tr -d '"'); do - [ "$VMS" != "" ] && VMS="${VMS}${SEPARATOR}" - VMS="${VMS}${VM}" + [ "$VMS" != "" ] && VMS="${VMS}${SEPARATOR}" + VMS="${VMS}${VM}" done echo $VMS @@ -59,14 +59,14 @@ __vboxmanage_list_vms() { __vboxmanage_list_runningvms() { VMS="" if [ "$1" == "" ]; then - SEPARATOR=" " + SEPARATOR=" " else - SEPARATOR=$1 + SEPARATOR=$1 fi for VM in $(vboxmanage list runningvms | cut -d' ' -f1 | tr -d '"'); do - [ "$VMS" != "" ] && VMS="${VMS}${SEPARATOR}" - VMS="${VMS}${VM}" + [ "$VMS" != "" ] && VMS="${VMS}${SEPARATOR}" + VMS="${VMS}${VM}" done echo $VMS @@ -102,40 +102,40 @@ __vboxmanage_default() { # echo "DEBUG: cur: $cur, prev: $prev" # echo "DEBUG: default: |$p1|$p2|$p3|$p4|" case ${cur} in - -*) - echo $opts - # COMPREPLY=($(compgen -W "${opts}" -- ${cur})) - return 0 - ;; + -*) + echo $opts + # COMPREPLY=($(compgen -W "${opts}" -- ${cur})) + return 0 + ;; esac; for WORD in $opts; do - MATCH=0 - for OPT in "${COMP_WORDS[@]}"; do - # opts=$(echo ${opts} | grep -v $OPT); - if [ "$OPT" == "$WORD" ]; then - MATCH=1 - break; - fi - if [ "$OPT" == "-v" ] && [ "$WORD" == "--version" ]; then - MATCH=1 - break; - fi - if [ "$OPT" == "--version" ] && [ "$WORD" == "-v" ]; then - MATCH=1 - break; - fi - if [ "$OPT" == "-q" ] && [ "$WORD" == "--nologo" ]; then - MATCH=1 - break; - fi - if [ "$OPT" == "--nologo" ] && [ "$WORD" == "-q" ]; then - MATCH=1 - break; - fi - done - (( $MATCH == 1 )) && continue; - pruned="$pruned $WORD" + MATCH=0 + for OPT in "${COMP_WORDS[@]}"; do + # opts=$(echo ${opts} | grep -v $OPT); + if [ "$OPT" == "$WORD" ]; then + MATCH=1 + break; + fi + if [ "$OPT" == "-v" ] && [ "$WORD" == "--version" ]; then + MATCH=1 + break; + fi + if [ "$OPT" == "--version" ] && [ "$WORD" == "-v" ]; then + MATCH=1 + break; + fi + if [ "$OPT" == "-q" ] && [ "$WORD" == "--nologo" ]; then + MATCH=1 + break; + fi + if [ "$OPT" == "--nologo" ] && [ "$WORD" == "-q" ]; then + MATCH=1 + break; + fi + done + (( $MATCH == 1 )) && continue; + pruned="$pruned $WORD" done @@ -156,65 +156,65 @@ _vboxmanage() { # In case current is complete command case $cur in - startvm|list|controlvm) - COMPREPLY=($(compgen -W "$cur ")) - return 0 - ;; + startvm|list|controlvm) + COMPREPLY=($(compgen -W "$cur ")) + return 0 + ;; esac case $prev in - -v|--version) - return 0 - ;; + -v|--version) + return 0 + ;; - -l|--long) - opts=$(__vboxmanage_list "long") - COMPREPLY=($(compgen -W "${opts}" -- ${cur})) - return 0 - ;; - startvm|list) - opts=$(__vboxmanage_$prev) - COMPREPLY=($(compgen -W "${opts}" -- ${cur})) - return 0 - ;; - --type) - COMPREPLY=($(compgen -W "gui headless" -- ${cur})) - return 0 - ;; - gui|headless) - # Done. no more completion possible - return 0 - ;; - vboxmanage|-q|--nologo) - # echo "Got vboxmanage" - opts=$(__vboxmanage_default) - COMPREPLY=($(compgen -W "${opts}" -- ${cur})) - return 0 - ;; - controlvm) - opts=$(__vboxmanage_list_vms) - COMPREPLY=($(compgen -W "${opts}" -- ${cur})) - return 0 - ;; + -l|--long) + opts=$(__vboxmanage_list "long") + COMPREPLY=($(compgen -W "${opts}" -- ${cur})) + return 0 + ;; + startvm|list) + opts=$(__vboxmanage_$prev) + COMPREPLY=($(compgen -W "${opts}" -- ${cur})) + return 0 + ;; + --type) + COMPREPLY=($(compgen -W "gui headless" -- ${cur})) + return 0 + ;; + gui|headless) + # Done. no more completion possible + return 0 + ;; + vboxmanage|-q|--nologo) + # echo "Got vboxmanage" + opts=$(__vboxmanage_default) + COMPREPLY=($(compgen -W "${opts}" -- ${cur})) + return 0 + ;; + controlvm) + opts=$(__vboxmanage_list_vms) + COMPREPLY=($(compgen -W "${opts}" -- ${cur})) + return 0 + ;; esac for VM in $(__vboxmanage_list_vms); do - if [ "$VM" == "$prev" ]; then - pprev=${COMP_WORDS[COMP_CWORD-2]} - # echo "previous: $pprev" - case $pprev in - startvm) - opts="--type" - COMPREPLY=($(compgen -W "${opts}" -- ${cur})) - return 0 - ;; - controlvm) - opts=$(__vboxmanage_controlvm) - COMPREPLY=($(compgen -W "${opts}" -- ${cur})) - return 0; - ;; - esac - fi + if [ "$VM" == "$prev" ]; then + pprev=${COMP_WORDS[COMP_CWORD-2]} + # echo "previous: $pprev" + case $pprev in + startvm) + opts="--type" + COMPREPLY=($(compgen -W "${opts}" -- ${cur})) + return 0 + ;; + controlvm) + opts=$(__vboxmanage_controlvm) + COMPREPLY=($(compgen -W "${opts}" -- ${cur})) + return 0; + ;; + esac + fi done # echo "Got to end withoug completion" diff --git a/themes/parrot/parrot.theme.bash b/themes/parrot/parrot.theme.bash index 815aa952..a0d259dd 100644 --- a/themes/parrot/parrot.theme.bash +++ b/themes/parrot/parrot.theme.bash @@ -20,9 +20,9 @@ function prompt() { # We have color support; assume it's compliant with Ecma-48 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such # a case would tend to support setf rather than setaf.) - local color_prompt=yes + local color_prompt=yes else - local color_prompt= + local color_prompt= fi fi From 1f5d9b757f92da1998cdf19427d0ff494871ca87 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Wed, 28 Oct 2020 21:02:47 +0200 Subject: [PATCH 20/68] Fix newline and trailing space issues --- aliases/available/terraform.aliases.bash | 1 - aliases/available/terragrunt.aliases.bash | 1 - completion/available/kind.completion.bash | 1 - themes/githelpers.theme.bash | 6 +++--- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/aliases/available/terraform.aliases.bash b/aliases/available/terraform.aliases.bash index af5276de..d62a8c2c 100644 --- a/aliases/available/terraform.aliases.bash +++ b/aliases/available/terraform.aliases.bash @@ -8,4 +8,3 @@ alias tfv='terraform validate' alias tfp='terraform plan' alias tfa='terraform apply' alias tfd='terraform destory' - diff --git a/aliases/available/terragrunt.aliases.bash b/aliases/available/terragrunt.aliases.bash index f1d7e182..9395b351 100644 --- a/aliases/available/terragrunt.aliases.bash +++ b/aliases/available/terragrunt.aliases.bash @@ -13,4 +13,3 @@ alias tgva='terragrunt validate-all' alias tgpa='terragrunt plan-all' alias tgaa='terragrunt apply-all' alias tgda='terragrunt destroy-all' - diff --git a/completion/available/kind.completion.bash b/completion/available/kind.completion.bash index f7b061fe..be12a2d2 100644 --- a/completion/available/kind.completion.bash +++ b/completion/available/kind.completion.bash @@ -3,4 +3,3 @@ if _command_exists kind; then eval "$(kind completion bash)" fi - diff --git a/themes/githelpers.theme.bash b/themes/githelpers.theme.bash index 2d5829ff..ba089392 100644 --- a/themes/githelpers.theme.bash +++ b/themes/githelpers.theme.bash @@ -11,7 +11,7 @@ function _git-symbolic-ref { function _git-branch { if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then test -n "${VCS_STATUS_LOCAL_BRANCH}" && echo "${VCS_STATUS_LOCAL_BRANCH}" || return 1 - else + else git symbolic-ref -q --short HEAD 2> /dev/null || return 1 fi } @@ -19,7 +19,7 @@ function _git-branch { function _git-tag { if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then test -n "${VCS_STATUS_TAG}" && echo "${VCS_STATUS_TAG}" - else + else git describe --tags --exact-match 2> /dev/null fi } @@ -40,7 +40,7 @@ function _git-short-sha { function _git-friendly-ref { if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then _git-branch || _git-tag || _git-short-sha # there is no tag based describe output in gitstatus - else + else _git-branch || _git-tag || _git-commit-description || _git-short-sha fi } From 54116fc0683cdb8c9f70a3b1bacad97c6ba32afd Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Thu, 29 Oct 2020 23:05:23 +0200 Subject: [PATCH 21/68] Bump shellcheck, shfmt hooks to 2.1.4 --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 696fabf4..0a7ab794 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,7 +13,7 @@ repos: - id: mixed-line-ending - id: check-added-large-files - repo: https://github.com/jumanjihouse/pre-commit-hooks - rev: 1.11.0 + rev: 2.1.4 hooks: - id: git-check # Configure in .gitattributes - id: shellcheck From dd1474990ce6fb26265297bcc58107e507809f27 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Thu, 29 Oct 2020 23:05:49 +0200 Subject: [PATCH 22/68] Modify general editorconfig settings --- .editorconfig | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.editorconfig b/.editorconfig index 5a376252..3997f583 100755 --- a/.editorconfig +++ b/.editorconfig @@ -1,23 +1,17 @@ # EditorConfig is awesome: http://EditorConfig.org [*] -indent_style = tab -indent_size = 4 +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 -shell_variant = bash -binary_next_line = true # like -bn -switch_case_indent = true # like -ci -space_redirects = true # like -sr -keep_padding = true # like -kp -end_of_line = lf -charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace = false - [.git*] indent_style = tab From 0b9da701c4dcfabad8d12c7cec44400d73de27a5 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Thu, 29 Oct 2020 23:14:33 +0200 Subject: [PATCH 23/68] Rename lint CI job --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 535709c4..0a2dd357 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ jobs: include: - language: go go: "1.14" - name: Ubuntu 18.04 + name: pre-commit lint dist: bionic sudo: required before_script: From 3f688170478571f2de2d5c0457c655f878f63fa3 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Wed, 28 Oct 2020 21:04:04 +0200 Subject: [PATCH 24/68] Clean 90210 theme --- clean_files.txt | 1 + themes/90210/90210.theme.bash | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/clean_files.txt b/clean_files.txt index e69de29b..f0f8457e 100644 --- a/clean_files.txt +++ b/clean_files.txt @@ -0,0 +1 @@ +themes/90210/90210.theme.bash diff --git a/themes/90210/90210.theme.bash b/themes/90210/90210.theme.bash index e683e0ef..97c23f0e 100644 --- a/themes/90210/90210.theme.bash +++ b/themes/90210/90210.theme.bash @@ -10,8 +10,8 @@ GIT_THEME_PROMPT_PREFIX=" ${green}|" GIT_THEME_PROMPT_SUFFIX="${green}|" # Nicely formatted terminal prompt -function prompt_command(){ - export PS1="\n${bold_black}[${blue}\@${bold_black}]-${bold_black}[${green}\u${yellow}@${green}\h${bold_black}]-${bold_black}[${purple}\w${bold_black}]-$(scm_prompt_info)\n${reset_color}\$ " +function prompt_command() { + export PS1="\n${bold_black}[${blue}\@${bold_black}]-${bold_black}[${green}\u${yellow}@${green}\h${bold_black}]-${bold_black}[${purple}\w${bold_black}]-$(scm_prompt_info)\n${reset_color}\$ " } safe_append_prompt_command prompt_command From b667a719952bbe508795f3f9535f5d6421c356a5 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sat, 24 Oct 2020 10:45:38 +0300 Subject: [PATCH 25/68] docs: Add basic sphinx docs --- docs/Makefile | 20 ++++++++++++++++++ docs/conf.py | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ docs/index.rst | 14 +++++++++++++ docs/make.bat | 35 ++++++++++++++++++++++++++++++++ 4 files changed, 124 insertions(+) create mode 100644 docs/Makefile create mode 100644 docs/conf.py create mode 100644 docs/index.rst create mode 100644 docs/make.bat diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000..d4bb2cbb --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000..af4615e5 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,55 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'Bash-it' +copyright = '2020, Bash-it Team' +author = 'Bash-it Team' + +# The full version, including alpha/beta/rc tags +release = '' + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000..d70cf6de --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,14 @@ +Welcome to Bash-it's documentation! +=================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 00000000..2119f510 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd From 6abb26c6c6970ff68281085495e7ce4f7b6e5de1 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Wed, 28 Oct 2020 09:20:02 +0200 Subject: [PATCH 26/68] docs: Add empty _static and _templates directories --- docs/_static/.keep | 0 docs/_templates/.keep | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/_static/.keep create mode 100644 docs/_templates/.keep diff --git a/docs/_static/.keep b/docs/_static/.keep new file mode 100644 index 00000000..e69de29b diff --git a/docs/_templates/.keep b/docs/_templates/.keep new file mode 100644 index 00000000..e69de29b From f7e295f691c8a245771d9538f5b2045c5dc35e10 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sun, 25 Oct 2020 14:51:02 +0200 Subject: [PATCH 27/68] Move most of the documentation to .rst format --- docs/commands/doctor.rst | 20 ++++ docs/commands/index.rst | 15 +++ docs/commands/reload.rst | 10 ++ docs/commands/search.rst | 59 ++++++++++++ docs/commands/update.rst | 38 ++++++++ docs/contributing.rst | 108 +++++++++++++++++++++ docs/custom.rst | 18 ++++ docs/development.rst | 94 +++++++++++++++++++ docs/index.rst | 40 ++++++-- docs/installation.rst | 57 +++++++++++ docs/misc.rst | 76 +++++++++++++++ docs/test.rst | 46 +++++++++ docs/themes.rst | 35 +++++++ docs/uninstalling.rst | 14 +++ docs/vcs_user.rst | 198 +++++++++++++++++++++++++++++++++++++++ 15 files changed, 822 insertions(+), 6 deletions(-) create mode 100644 docs/commands/doctor.rst create mode 100644 docs/commands/index.rst create mode 100644 docs/commands/reload.rst create mode 100644 docs/commands/search.rst create mode 100644 docs/commands/update.rst create mode 100644 docs/contributing.rst create mode 100644 docs/custom.rst create mode 100644 docs/development.rst create mode 100644 docs/installation.rst create mode 100644 docs/misc.rst create mode 100644 docs/test.rst create mode 100644 docs/themes.rst create mode 100644 docs/uninstalling.rst create mode 100644 docs/vcs_user.rst diff --git a/docs/commands/doctor.rst b/docs/commands/doctor.rst new file mode 100644 index 00000000..625eff20 --- /dev/null +++ b/docs/commands/doctor.rst @@ -0,0 +1,20 @@ +.. _doctor: + +Bash-it doctor +^^^^^^^^^^^^^^ + +If you encounter problems with any part of Bash-it, run the following command: + +.. code-block:: bash + + bash-it doctor + +This will reload your bash profile and print out logs of various parts in Bash-it. +Note that this command at default will print all logs, including debug logs. +You can call it like this: + +.. code-block:: bash + + bash-it doctor [errors/warnings/all] + +In order to get wanted verbosity. diff --git a/docs/commands/index.rst b/docs/commands/index.rst new file mode 100644 index 00000000..3eee3b3a --- /dev/null +++ b/docs/commands/index.rst @@ -0,0 +1,15 @@ +.. _commands: + +Bash-it Commands +================ + +**Bash-it** boasts a wide range of available commands. +You should be familiar with them in order to fully utilize Bash-it. + +.. toctree:: + :maxdepth: 1 + + update + search + reload + doctor diff --git a/docs/commands/reload.rst b/docs/commands/reload.rst new file mode 100644 index 00000000..722182d1 --- /dev/null +++ b/docs/commands/reload.rst @@ -0,0 +1,10 @@ +.. _reload: + +Bash-it reload +^^^^^^^^^^^^^^ + +Bash-it creates a ``reload`` alias that makes it convenient to reload +your Bash profile when you make changes. + +Additionally, if you export ``BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE`` as a non-null value, +Bash-it will automatically reload itself after activating or deactivating plugins, aliases, or completions. diff --git a/docs/commands/search.rst b/docs/commands/search.rst new file mode 100644 index 00000000..1b455f22 --- /dev/null +++ b/docs/commands/search.rst @@ -0,0 +1,59 @@ +.. _searching: + +Bash-it search +-------------- + +If you need to quickly find out which of the plugins, aliases or completions are available for a specific framework, programming language, or an environment, you can *search* for multiple terms related to the commands you use frequently. +Search will find and print out modules with the name or description matching the terms provided. + +Syntax +^^^^^^ + +.. code-block:: bash + + bash-it search term1 [[-]term2] [[-]term3].... + +As an example, a ruby developer might want to enable everything related to the commands such as ``ruby``\ , ``rake``\ , ``gem``\ , ``bundler``\ , and ``rails``. +Search command helps you find related modules so that you can decide which of them you'd like to use: + +.. code-block:: bash + + ❯ bash-it search ruby rake gem bundle irb rails + aliases: bundler rails + plugins: chruby chruby-auto ruby + completions: bundler gem rake + +Currently enabled modules will be shown in green. + +Searching with Negations +^^^^^^^^^^^^^^^^^^^^^^^^ + +You can prefix a search term with a "-" to exclude it from the results. +In the above example, if we wanted to hide ``chruby`` and ``chruby-auto``\ , +we could change the command as follows: + +.. code-block:: bash + + ❯ bash-it search ruby rake gem bundle irb rails -chruby + aliases: bundler rails + plugins: ruby + completions: bundler gem rake + +Using Search to Enable or Disable Components +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +By adding a ``--enable`` or ``--disable`` to the search command, you can automatically enable all modules that come up as a result of a search query. +This could be quite handy if you like to enable a bunch of components related to the same topic. + +Disabling ASCII Color +^^^^^^^^^^^^^^^^^^^^^ + +To remove non-printing non-ASCII characters responsible for the coloring of the search output, you can set environment variable ``NO_COLOR``. +Enabled components will then be shown with a checkmark: + +.. code-block:: bash + + ❯ NO_COLOR=1 bash-it search ruby rake gem bundle irb rails -chruby + aliases => ✓bundler ✓rails + plugins => ✓ruby + completions => bundler gem rake diff --git a/docs/commands/update.rst b/docs/commands/update.rst new file mode 100644 index 00000000..92db60fb --- /dev/null +++ b/docs/commands/update.rst @@ -0,0 +1,38 @@ +.. _update: + +Bash-it update +^^^^^^^^^^^^^^ + +To update Bash-it to the latest stable version, simply run: + +.. code-block:: bash + + bash-it update stable + +If you want to update to the latest dev version (directly from master), run: + +.. code-block:: bash + + bash-it update dev + +If you want to update automatically and unattended, you can add the optional +``-s/--silent`` flag, for example: + +.. code-block:: bash + + bash-it update dev --silent + +.. _migrate: + +Bash-it migrate +^^^^^^^^^^^^^^^ + +If you are using an older version of Bash-it, it's possible that some functionality has changed, or that the internal structure of how Bash-it organizes its functionality has been updated. +For these cases, we provide a ``migrate`` command: + +.. code-block:: bash + + bash-it migrate + +This command will automatically migrate the Bash-it structure to the latest version. +The ``migrate`` command is run automatically if you run the ``update``\ , ``enable`` or ``disable`` commands. diff --git a/docs/contributing.rst b/docs/contributing.rst new file mode 100644 index 00000000..e2c3f5ca --- /dev/null +++ b/docs/contributing.rst @@ -0,0 +1,108 @@ +.. _contributing: + +Contribution Guidelines +======================= + +When contributing a new feature, a bug fix, a new theme, or any other change to Bash-it, please consider the following guidelines. +Most of this is common sense, but please try to stick to the conventions listed here. + +Issues +------ + + +* When opening a new issue in the issue tracker, please include information about which *Operating System* you're using, and which version of *Bash*. +* In many cases, it also makes sense to show which Bash-it plugins you are using. + This information can be obtained using ``bash-it show plugins``. +* If the issue happens while loading Bash-it, please also include your ``~/.bash_profile`` or ``~/.bashrc`` file, + as well as the install location of Bash-it (default should be ``~/.bash_it``\ ). +* When reporting a bug or requesting a new feature, consider providing a Pull Request that fixes the issue or can be used as a starting point for the new feature. + Don't be afraid, most things aren't that complex... + +Pull Requests +------------- + + +* Fork the Bash-it repo, create a new feature branch from *master* and apply your changes there. + Create a *Pull Request* from your feature branch against Bash-it's *master* branch. +* Limit each Pull Request to one feature. + Don't bundle multiple features/changes (e.g. a new *Theme* and a fix to an existing plugin) into a single Pull Request - create one PR for the theme, and a separate PR for the fix. +* For complex changes, try to *squash* your changes into a single commit before + pushing code. Once you've pushed your code and opened a PR, please refrain + from force-pushing changes to the PR branch – remember, Bash-it is a + distributed project and your branch may be in use already. +* When in doubt, open a PR with too many commits. Bash-it is a learning project + for everyone involved. Showing your work provides a great history for folks + to learn what works and what didn't. + +Code Style +---------- + + +* Try to stick to the existing code style. Please don't reformat or change the syntax of existing code simply because you don't like that style. +* Indentation is using spaces, not tabs. Most of the code is indented with 2 spaces, some with 4 spaces. Please try to stick to 2 spaces. + If you're using an editor that supports `EditorConfig `_\ , 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``. + Don't use underscores, e.g. ``my_new_function``. +* Internal functions that aren't to be used by the end user should start with an underscore, e.g. ``_my-new-internal-function``. +* Use the provided meta functions to document your code, e.g. ``about-plugin``\ , ``about``\ , ``group``\ , ``param``\ , ``example``. + This will make it easier for other people to use your new functionality. + Take a look at the existing code for an example (e.g. `the base plugin `_\ ). +* When adding files, please use the existing file naming conventions, e.g. plugin files need to end in ``.plugin.bash``. + This is important for the installation functionality. +* When using the ``$BASH_IT`` variable, please always enclose it in double quotes to ensure that the code also works when Bash-it is installed in a directory that contains spaces in its name: ``for f in "${BASH_IT}/plugins/available"/*.bash ; do echo "$f" ; done`` +* Bash-it supports Bash 3.2 and higher. Please don't use features only available in Bash 4, such as associative arrays. + +Unit Tests +---------- + +When adding features or making changes/fixes, please run our growing unit test suite to ensure that you did not break existing functionality. +The test suite does not cover all aspects of Bash-it, but please run it anyway to verify that you did not introduce any regression issues. + +Any code pushed to GitHub as part of a Pull Request will automatically trigger a continuous integration build on `Travis CI `_\ , where the test suite is run on both Linux and macOS. +The Pull Request will then show the result of the Travis build, indicating whether all tests ran fine, or whether there were issues. +Please pay attention to this, Pull Requests with build issues will not be merged. + +Adding new functionality or changing existing functionality is a good opportunity to increase Bash-it's test coverage. +When you're changing the Bash-it codebase, please consider adding some unit tests that cover the new or changed functionality. +Ideally, when fixing a bug, a matching unit test that verifies that the bug is no longer present, is added at the same time. + +To run the test suite, simply execute the following in the directory where you cloned Bash-it: + +.. code-block:: bash + + test/run + +This command will ensure that the `Bats Test Framework `_ is available in the local ``test_lib`` directory (Bats is included as a Git submodule) and then run the test suite found in the `test `_ folder. +The test script will execute each test in turn, and will print a status for each test case. + +When adding new test cases, please take a look at the existing test cases for examples. + +The following libraries are used to help with the tests: + + +* Test Framework: https://github.com/bats-core/bats-core +* Support library for Bats-Assert: https://github.com/ztombol/bats-support +* General ``assert`` functions: https://github.com/ztombol/bats-assert +* File ``assert`` functions: https://github.com/ztombol/bats-file + +When verifying test results, please try to use the ``assert`` functions found in these libraries. + +Features +-------- + + +* When adding new completions or plugins, please don't simply copy existing tools into the Bash-it codebase, try to load/integrate the tools instead. + An example is using ``nvm``\ : Instead of copying the existing ``nvm`` script into Bash-it, the ``nvm.plugin.bash`` file tries to load an existing installation of ``nvm``. + This means an additional step for the user (installing ``nvm`` from its own repo, or through a package manager), + but it will also ensure that ``nvm`` can be upgraded in an easy way. + +.. _contributing_theme: + +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. + The project's Wiki has a *Themes* page where you can add a screenshot if you want. +* Ideally, each theme's folder should contain a ``README.md`` file describing the theme and its configuration options. diff --git a/docs/custom.rst b/docs/custom.rst new file mode 100644 index 00000000..5da41592 --- /dev/null +++ b/docs/custom.rst @@ -0,0 +1,18 @@ +.. _custom: + +Custom Content +-------------- + +For custom scripts, and aliases, just create the following files (they'll be ignored by the git repo): + + +* ``aliases/custom.aliases.bash`` +* ``completion/custom.completion.bash`` +* ``lib/custom.bash`` +* ``plugins/custom.plugins.bash`` +* ``custom/themes//.theme.bash`` + +Anything in the custom directory will be ignored, with the exception of ``custom/example.bash``. + +Alternately, if you would like to keep your custom scripts under version control, you can set ``BASH_IT_CUSTOM`` in your ``~/.bashrc`` to another location outside of the ``$BASH_IT`` folder. +In this case, any ``*.bash`` file under every directory below ``BASH_IT_CUSTOM`` folder will be used. diff --git a/docs/development.rst b/docs/development.rst new file mode 100644 index 00000000..924d189b --- /dev/null +++ b/docs/development.rst @@ -0,0 +1,94 @@ +.. _development: + +Bash-it Development +=================== + +This page summarizes a couple of rules to keep in mind when developing features or making changes in Bash-it. + +Testing +------- + +Make sure to read the :ref:`testing docs`. + +Debugging and Logging +--------------------- + +General Logging +^^^^^^^^^^^^^^^ + +While developing feature or making changes in general, you can log error/warning/debug +using ``_log_error`` ``_log_warning`` and ``_log_debug``. This will help you solve problems quicker +and also propagate important notes to other users of Bash-it. +You can see the logs by using ``bash-it doctor`` command to reload and see the logs. +Alternatively, you can set ``BASH_IT_LOG_LEVEL`` to ``BASH_IT_LOG_LEVEL_ERROR``\ , ``BASH_IT_LOG_LEVEL_WARNING`` or ``BASH_IT_LOG_LEVEL_ALL``. + +Log Prefix/Context +^^^^^^^^^^^^^^^^^^ + +You can define ``BASH_IT_LOG_PREFIX`` in your files in order to a have a constant prefix before your logs. +Note that we prefer to uses "tags" based logging, i.e ``plugins: git: DEBUG: Loading git plugin``. + +Load Order +---------- + +General Load Order +^^^^^^^^^^^^^^^^^^ + +The main ``bash_it.sh`` script loads the frameworks individual components in the following order: + + +* ``lib/composure.bash`` +* Files in ``lib`` with the exception of ``appearance.bash`` - this means that ``composure.bash`` is loaded again here (possible improvement?) +* Enabled ``aliases`` +* Enabled ``plugins`` +* Enabled ``completions`` +* ``themes/colors.theme.bash`` +* ``themes/base.theme.bash`` +* ``lib/appearance.bash``\ , which loads the selected theme +* Custom ``aliases`` +* Custom ``plugins`` +* Custom ``completions`` +* Additional custom files from either ``$BASH_IT/custom`` or ``$BASH_IT_CUSTOM`` + +This order is subject to change. + +Individual Component Load Order +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +For ``aliases``\ , ``plugins`` and ``completions``\ , the following rules are applied that influence the load order: + + +* There is a global ``enabled`` directory, which the enabled components are linked into. Enabled plugins are symlinked from ``$BASH_IT/plugins/available`` to ``$BASH_IT/enabled`` for example. All component types are linked into the same common ``$BASH_IT/enabled`` directory. +* Within the common ``enabled`` directories, the files are loaded in alphabetical order, which is based on the item's load priority (see next item). +* When enabling a component, a *load priority* is assigned to the file. The following default priorities are used: + + * Aliases: 150 + * Plugins: 250 + * Completions: 350 + +* When symlinking a component into the ``enabled`` directory, the load priority is used as a prefix for the linked name, separated with three dashes from the name of the component. The ``node.plugin.bash`` would be symlinked to ``250---node.plugin.bash`` for example. +* + Each file can override the default load priority by specifying a new value. To do this, the file needs to include a comment in the following form. This example would cause the ``node.plugin.bash`` (if included in that file) to be linked to ``225---node.plugin.bash``\ : + + .. code-block:: bash + + # BASH_IT_LOAD_PRIORITY: 225 + +Having the order based on a numeric priority in a common directory allows for more flexibility. While in general, aliases are loaded first (since their default priority is 150), it's possible to load some aliases after the plugins, or some plugins after completions by setting the items' load priority. This is more flexible than a fixed type-based order or a strict alphabetical order based on name. + +These items are subject to change. When making changes to the internal functionality, this page needs to be updated as well. + +Plugin Disable Callbacks +------------------------ + +Plugins can define a function that will be called when the plugin is being disabled. +The callback name should be ``{PLUGIN_NAME}_on_disable``\ , you can see ``gitstatus`` for usage example. + +Using the pre-commit hook +------------------------- + +Note the file .pre-commit-config.yaml at the top of the repo. +This file configures the behavior of the a pre-commit hook based on `the Pre-Commit framework `_. Please see the site about +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 `_ and `shfmt `_. diff --git a/docs/index.rst b/docs/index.rst index d70cf6de..7f4649e7 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,14 +1,42 @@ + Welcome to Bash-it's documentation! =================================== +**Bash-it** is a collection of community Bash commands and scripts for Bash 3.2+. +(And a shameless ripoff of `oh-my-zsh `_) + +Includes autocompletion, themes, aliases, custom functions, a few stolen pieces from Steve Losh, and more. + +Bash-it provides a solid framework for using, developing and maintaining shell scripts and custom commands for your daily work. +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. + .. toctree:: - :maxdepth: 2 - :caption: Contents: + :maxdepth: 1 + + contributing + development + test + installation + commands/index + custom + themes + vcs_user + misc + uninstalling +Help out +-------- -Indices and tables -================== +We think everyone has their own custom scripts accumulated over time. +And so, following in the footsteps of oh-my-zsh, Bash-it is a framework for easily customizing your Bash shell. +Everyone's got a custom toolbox, so let's start making them even better, **as a community!** -* :ref:`genindex` -* :ref:`search` +Send us a pull request and we'll merge it as long as it looks good. +If you change an existing command, please give an explanation why. +That will help a lot when we merge your changes in. + +Please take a look at the :ref:`Contribution Guidelines ` before reporting a bug or providing a new feature. + +Thanks, and happing bashing! diff --git a/docs/installation.rst b/docs/installation.rst new file mode 100644 index 00000000..12cc9437 --- /dev/null +++ b/docs/installation.rst @@ -0,0 +1,57 @@ +.. _installation: + +Installation +------------ + + +#. 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`` +#. Run ``~/.bash_it/install.sh`` (it automatically backs up your ``~/.bash_profile`` or ``~/.bashrc``\ , depending on your OS) +#. Edit your modified config (\ ``~/.bash_profile`` or ``~/.bashrc``\ ) file in order to customize Bash-it. +#. Check out available aliases, completions, and plugins and enable the ones you want to use (see the next section for more details). + +Install Options +^^^^^^^^^^^^^^^ + +The install script can take the following options: + + +* ``--interactive``\ : Asks the user which aliases, completions and plugins to enable. +* ``--silent``\ : Ask nothing and install using default settings. +* ``--no-modify-config``\ : Do not modify the existing config file (\ ``~/.bash_profile`` or ``~/.bashrc``\ ). + +When run without the ``--interactive`` switch, Bash-it only enables a sane default set of functionality to keep your shell clean and to avoid issues with missing dependencies. +Feel free to enable the tools you want to use after the installation. + +When you run without the ``--no-modify-config`` switch, the Bash-it installer automatically modifies/replaces your existing config file. +Use the ``--no-modify-config`` switch to avoid unwanted modifications, e.g. if your Bash config file already contains the code that loads Bash-it. + +**NOTE**\ : Keep in mind how Bash loads its configuration files, +``.bash_profile`` for login shells (and in macOS in terminal emulators like `Terminal.app `_ or +`iTerm2 `_\ ) and ``.bashrc`` for interactive shells (default mode in most of the GNU/Linux terminal emulators), +to ensure that Bash-it is loaded correctly. +A good "practice" is sourcing ``.bashrc`` into ``.bash_profile`` to keep things working in all the scenarios. +To achieve this, you can add this snippet in your ``.bash_profile``\ : + +.. code-block:: + + if [ -f ~/.bashrc ]; then + . ~/.bashrc + fi + +Refer to the official `Bash documentation `_ to get more info. + +Install using Docker +^^^^^^^^^^^^^^^^^^^^ + +You can try Bash-it in an isolated environment without changing any local files via a `Docker `_ Container. +(Bash Shell v4.4 with Bash-it, `bats `_\ ,and bash-completion based on `Alpine Linux `_\ ). + +``docker pull ellerbrock/bash-it`` + +Have a look at our `bash-it-docker repository `_ for further information. + +Updating +^^^^^^^^ + +See :ref:`update command `. diff --git a/docs/misc.rst b/docs/misc.rst new file mode 100644 index 00000000..c576d926 --- /dev/null +++ b/docs/misc.rst @@ -0,0 +1,76 @@ +.. _misc: + +Misc +---- + +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 + +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 `_. +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. diff --git a/docs/test.rst b/docs/test.rst new file mode 100644 index 00000000..8f616560 --- /dev/null +++ b/docs/test.rst @@ -0,0 +1,46 @@ +.. _test: + +Testing Bash-it +=============== + +Overview +-------- + +The Bash-it unit tests leverage the `Bats unit test framework for Bash `_. +There is no need to install Bats explicitly, the test run script will automatically download and install Bats and its dependencies. + +When making changes to Bash-it, the tests are automatically executed in a test build environment on `Travis CI `_. + +Test Execution +-------------- + +To execute the unit tests, please run the ``run`` script: + +.. code-block:: bash + + # If you are in the `test` directory: + ./run + + # If you are in the root `.bash_it` directory: + test/run + +The ``run`` script will automatically install if it is not already present, and will then run all tests found under the ``test`` directory, including subdirectories. + +To run only a subset of the tests, you can provide the name of the test subdirectory that you want to run, e.g. like this for the tests in the ``test/themes`` directory: + +.. code-block:: bash + + # If you are in the root `.bash_it` directory: + test/run test/themes + +By default, the tests run in single-threaded mode. +If you want to speed up the test execution, you can install the `GNU ``parallel`` tool `_\ , which is supported by Bats. +When using ``parallel``\ , the ``test/run`` script will use a number of threads in parallel, depending on the available CPU cores of your system. +This can speed up test execution significantly. + +Writing Tests +------------- + +When adding or modifying tests, please stick to the format and conventions of the existing test cases. +The ``test_helper.bash`` script provides a couple of reusable helper functions that you should use when writing a test case, +for example for setting up an isolated test environment. diff --git a/docs/themes.rst b/docs/themes.rst new file mode 100644 index 00000000..27b93a29 --- /dev/null +++ b/docs/themes.rst @@ -0,0 +1,35 @@ +.. _themes: + +Themes +------ + +There are over 50+ Bash-it themes to pick from in ``$BASH_IT/themes``. +The default theme is ``bobby``. +Set ``BASH_IT_THEME`` to the theme name you want, or if you've developed your own custom theme outside of ``$BASH_IT/themes``\ , +point the ``BASH_IT_THEME`` variable directly to the theme file. +To disable theming completely, leave the variable empty. + +Examples: + +.. code-block:: bash + + # Use the "powerline-multiline" theme + export BASH_IT_THEME="powerline-multiline" + + # Use a theme outside of the Bash-it folder + export BASH_IT_THEME="/home/foo/my_theme/my_theme.theme.bash" + + # Disable theming + export BASH_IT_THEME="" + +You can easily preview the themes in your own shell using ``BASH_PREVIEW=true bash-it reload``. + +If you've created your own custom prompts, we'd love it if you shared them with everyone else! Just submit a Pull Request. +You can see theme screenshots on `wiki/Themes `_. + +**NOTE**\ : Bash-it and some themes use UTF-8 characters, so to avoid strange behavior in your terminal, set your locale to ``LC_ALL=en_US.UTF-8`` or the equivalent to your language if it isn't American English. + +Contributing a new theme +^^^^^^^^^^^^^^^^^^^^^^^^ + +See the :ref:`instructions `. diff --git a/docs/uninstalling.rst b/docs/uninstalling.rst new file mode 100644 index 00000000..dab1430d --- /dev/null +++ b/docs/uninstalling.rst @@ -0,0 +1,14 @@ +.. _uninstalling: + +Uninstalling +------------ + +To uninstall Bash-it, run the ``uninstall.sh`` script found in the ``$BASH_IT`` directory: + +.. code-block:: + + cd $BASH_IT + ./uninstall.sh + +This will restore your previous Bash profile. +After the uninstall script finishes, remove the Bash-it directory from your machine (\ ``rm -rf $BASH_IT``\ ) and start a new shell. diff --git a/docs/vcs_user.rst b/docs/vcs_user.rst new file mode 100644 index 00000000..c876f584 --- /dev/null +++ b/docs/vcs_user.rst @@ -0,0 +1,198 @@ +.. _vcs_user: + +Prompt Version Control Information +================================== + +Bash-it provides prompt :ref:`themes` with the ability to check and display version control information for the current directory. +The information is retrieved for each directory and can slow down the navigation of projects with a large number of files and folders. +Turn version control checking off to prevent slow directory navigation within large projects. + +Controlling Flags +^^^^^^^^^^^^^^^^^ + +Bash-it provides a flag (\ ``SCM_CHECK``\ ) within the ``~/.bash_profile`` file that turns off/on version control information checking and display within all themes. +Version control checking is on by default unless explicitly turned off. + +Set ``SCM_CHECK`` to 'false' to **turn off** version control checks for all themes: + + +* ``export SCM_CHECK=false`` + +Set ``SCM_CHECK`` to 'true' (the default value) to **turn on** version control checks for all themes: + + +* ``export SCM_CHECK=true`` + +**NOTE:** +It is possible for themes to ignore the ``SCM_CHECK`` flag and query specific version control information directly. +For example, themes that use functions like ``git_prompt_vars`` skip the ``SCM_CHECK`` flag to retrieve and display git prompt information. +If you turned version control checking off and you still see version control information within your prompt, then functions like ``git_prompt_vars`` are most likely the reason why. + +Git prompt +^^^^^^^^^^ + +Bash-it has some nice features related to Git, continue reading to know more about these features. + +Repository info in the prompt +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Bash-it can show some information about Git repositories in the shell prompt: the current branch, tag or commit you are at, how many commits the local branch is ahead or behind from the remote branch, and if you have changes stashed. + +Additionally, you can view the status of your working copy and get the count of *staged*\ , *unstaged* and *untracked* files. +This feature is controlled through the flag ``SCM_GIT_SHOW_DETAILS`` as follows: + +Set ``SCM_GIT_SHOW_DETAILS`` to 'true' (the default value) to **show** the working copy details in your prompt: + + +* ``export SCM_GIT_SHOW_DETAILS=true`` + +Set ``SCM_GIT_SHOW_DETAILS`` to 'false' to **don't show** it: + + +* ``export SCM_GIT_SHOW_DETAILS=false`` + +**NOTE:** If using ``SCM_GIT_SHOW_MINIMAL_INFO=true``\ , then the value of ``SCM_GIT_SHOW_DETAILS`` is ignored. + +Remotes and remote branches +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In some git workflows, you must work with various remotes, for this reason, Bash-it can provide some useful information about your remotes and your remote branches, for example, the remote on you are working, or if your local branch is tracking a remote branch. + +You can control this feature with the flag ``SCM_GIT_SHOW_REMOTE_INFO`` as follows: + +Set ``SCM_GIT_SHOW_REMOTE_INFO`` to 'auto' (the default value) to activate it only when more than one remote is configured in the current repo: + + +* ``export SCM_GIT_SHOW_REMOTE_INFO=auto`` + +Set ``SCM_GIT_SHOW_REMOTE_INFO`` to 'true' to always activate the feature: + + +* ``export SCM_GIT_SHOW_REMOTE_INFO=true`` + +Set ``SCM_GIT_SHOW_REMOTE_INFO`` to 'false' to **disable the feature**\ : + + +* ``export SCM_GIT_SHOW_REMOTE_INFO=false`` + +**NOTE:** If using ``SCM_GIT_SHOW_MINIMAL_INFO=true``\ , then the value of ``SCM_GIT_SHOW_REMOTE_INFO`` is ignored. + +Untracked files +^^^^^^^^^^^^^^^ + +By default, the ``git status`` command shows information about *untracked* files. +This behavior can be controlled through command-line flags or git configuration files. +For big repositories, ignoring *untracked* files can make git faster. +Bash-it uses ``git status`` to gather the repo information it shows in the prompt, so in some circumstances, it can be useful to instruct Bash-it to ignore these files. +You can control this behavior with the flag ``SCM_GIT_IGNORE_UNTRACKED``\ : + +Set ``SCM_GIT_IGNORE_UNTRACKED`` to 'false' (the default value) to get information about *untracked* files: + + +* ``export SCM_GIT_IGNORE_UNTRACKED=false`` + +Set ``SCM_GIT_IGNORE_UNTRACKED`` to 'true' to **ignore** *untracked* files: + + +* ``export SCM_GIT_IGNORE_UNTRACKED=true`` + +Also, with this flag to false, Bash-it will not show the repository as dirty when the repo has *untracked* files, and will not display the count of *untracked* files. + +**NOTE:** If you set in git configuration file the option to ignore *untracked* files, this flag has no effect, and Bash-it will ignore *untracked* files always. + +Stash item count +^^^^^^^^^^^^^^^^ + +When ``SCM_GIT_SHOW_DETAILS`` is enabled, you can get the count of *stashed* items. This feature can be useful when a user has a lot of stash items. +This feature is controlled through the flag ``SCM_GIT_SHOW_STASH_INFO`` as follows: + +Set ``SCM_GIT_SHOW_STASH_INFO`` to 'true' (the default value) to **show** the count of stashed items: + + +* ``export SCM_GIT_SHOW_STASH_INFO=true`` + +Set ``SCM_GIT_SHOW_STASH_INFO`` to 'false' to **don't show** it: + + +* ``export SCM_GIT_SHOW_STASH_INFO=false`` + +Ahead/Behind Count +^^^^^^^^^^^^^^^^^^ + +When displaying information regarding whether or not the local branch is ahead or behind its remote counterpart, you can opt to display the number of commits ahead/behind. +This is useful if you only care whether or not you are ahead or behind and do not care how far ahead/behind you are. + +Set ``SCM_GIT_SHOW_COMMIT_COUNT`` to 'true' (the default value) to **show** the count of commits ahead/behind: + + +* ``export SCM_GIT_SHOW_COMMIT_COUNT=true`` + +Set ``SCM_GIT_SHOW_COMMIT_COUNT`` to 'false' to **don't show** it: + + +* ``export SCM_GIT_SHOW_COMMIT_COUNT=false`` + +Git user +^^^^^^^^ + +In some environments, it is useful to know the value of the current git user, which is used to mark all new commits. +For example, any organization that uses the practice of pair programming will typically author each commit with `combined names of the two authors `_. +When another pair uses the same pairing station, the authors are changed at the beginning of the session. + +To get up and running with this technique, run ``gem install pivotal_git_scripts``\ , and then edit your ``~/.pairs`` file, according to the specification on the `gem's homepage `_. +After that, you should be able to run ``git pair kg as`` to set the author to, eg. "Konstantin Gredeskoul and Alex Saxby", assuming they've been added to the ``~/.pairs`` file. +Please see gem's documentation for more information. + +To enable the display of the current pair in the prompt, you must set ``SCM_GIT_SHOW_CURRENT_USER`` to ``true``. +Once set, the ``SCM_CURRENT_USER`` variable will be automatically populated with the initials of the git author(s). +It will also be included in the default git prompt. +Even if you do not have ``git pair`` installed, as long as your ``user.name`` is set, your initials will be computed from your name and shown in the prompt. + +You can control the prefix and the suffix of this component using the two variables: + + +* ``export SCM_THEME_CURRENT_USER_PREFFIX=' ☺︎ '`` + +And + + +* ``export SCM_THEME_CURRENT_USER_SUFFIX=' ☺︎ '`` + +**NOTE:** If using ``SCM_GIT_SHOW_MINIMAL_INFO=true``\ , then the value of ``SCM_GIT_SHOW_CURRENT_USER`` is ignored. + +Git show minimal status info +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To speed up the prompt while still getting minimal git status information displayed such as the value of ``HEAD`` and whether there are any dirty objects, you can set: + +.. code-block:: + + export SCM_GIT_SHOW_MINIMAL_INFO=true + +Ignore repo status +^^^^^^^^^^^^^^^^^^ + +When working in repos with a large codebase, Bash-it can slow down your prompt when checking the repo status. +To avoid it, there is an option you can set via Git config to disable checking repo status in Bash-it. + +To disable checking the status in the current repo: + +.. code-block:: + + $ git config --add bash-it.hide-status 1 + +But if you would like to disable it globally, and stop checking the status for all of your repos: + +.. code-block:: + + $ git config --global --add bash-it.hide-status 1 + +Setting this flag globally has the same effect as ``SCM_CHECK=true``\ , but only for Git repos. + +Speed up git status calculations +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +As an alternative to ignoring repo status entirely, you can try out the ``gitstatus`` plugin. +This plugin speeds up all ``git status`` calculations by up to 10x times! + +**NOTE**\ : You will need to clone ``gitstatus`` repo from `here `_. From 122841865342051e0bcd3f8f70ce5edcf4068d27 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sun, 25 Oct 2020 14:59:22 +0200 Subject: [PATCH 28/68] docs: Change theme to sphinx rtd theme --- docs/conf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index af4615e5..d11bc0a3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -31,6 +31,7 @@ release = '' # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ + 'sphinx_rtd_theme' ] # Add any paths that contain templates here, relative to this directory. @@ -47,7 +48,7 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'alabaster' +html_theme = 'sphinx_rtd_theme' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, From 3844b652b4eba92fa25e133632c3561515622272 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sun, 25 Oct 2020 14:59:36 +0200 Subject: [PATCH 29/68] Add readthedocs configuration --- .readthedocs.yml | 10 ++++++++++ docs/requirements.txt | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 .readthedocs.yml create mode 100644 docs/requirements.txt diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 00000000..751f3175 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,10 @@ +version: 2 + +sphinx: + builder: htmldir + configuration: docs/conf.py + +python: + version: 3.7 + install: + - requirements: docs/requirements.txt diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 00000000..36a96b36 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,2 @@ +sphinx == 3.2.1 +sphinx-rtd-theme==0.5.0 From 0076db0efb1113a96a0a452f9132e0ede3ed7098 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Wed, 28 Oct 2020 09:14:08 +0200 Subject: [PATCH 30/68] docs: Add CI stage --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0a2dd357..8f96e2aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,15 @@ cache: jobs: include: + - language: python + python: 3.8 + name: docs + dist: bionic + install: + pip3 install -r docs/requirements.txt; + script: + sphinx-build -W -b html docs docs/_build/html; + - language: go go: "1.14" name: pre-commit lint From a717283163841bfc558ac0608cde2241ae0867cb Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sat, 31 Oct 2020 23:02:09 +0200 Subject: [PATCH 31/68] docs: Add label to git_prompt section --- docs/vcs_user.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/vcs_user.rst b/docs/vcs_user.rst index c876f584..c6d31a57 100644 --- a/docs/vcs_user.rst +++ b/docs/vcs_user.rst @@ -28,6 +28,8 @@ It is possible for themes to ignore the ``SCM_CHECK`` flag and query specific ve For example, themes that use functions like ``git_prompt_vars`` skip the ``SCM_CHECK`` flag to retrieve and display git prompt information. If you turned version control checking off and you still see version control information within your prompt, then functions like ``git_prompt_vars`` are most likely the reason why. +.. _git_prompt: + Git prompt ^^^^^^^^^^ From 9edba505b5263cfab4f6ac97832834b93c624439 Mon Sep 17 00:00:00 2001 From: David Farrell Date: Tue, 3 Nov 2020 09:16:14 -0800 Subject: [PATCH 32/68] Adds better support for .bat files; Fixes docs/make.bat --- .gitattributes | 3 ++ .pre-commit-config.yaml | 1 + docs/make.bat | 70 ++++++++++++++++++++--------------------- 3 files changed, 39 insertions(+), 35 deletions(-) diff --git a/.gitattributes b/.gitattributes index d4c710cb..bb7d1461 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,5 @@ *.sh text eol=lf *.bash text eol=lf + +# Windows files +*.bat text eol=crlf diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0a7ab794..0bd696da 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,3 +25,4 @@ repos: hooks: # - id: forbid-crlf - id: remove-crlf + exclude: ".bat$" diff --git a/docs/make.bat b/docs/make.bat index 2119f510..922152e9 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -1,35 +1,35 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=. -set BUILDDIR=_build - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end -popd +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd From da9b7100144c3ada2ec24e35aa3038429b96678c Mon Sep 17 00:00:00 2001 From: David Farrell Date: Tue, 3 Nov 2020 10:10:11 -0800 Subject: [PATCH 33/68] Moves lint logic into lint_clean_files.sh --- .travis.yml | 2 +- clean_files.txt | 1 + lint_clean_files.sh | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100755 lint_clean_files.sh diff --git a/.travis.yml b/.travis.yml index 8f96e2aa..d199e9d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,7 @@ jobs: GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt; curl https://pre-commit.com/install-local.py | python3 - script: - pre-commit run --files `cat clean_files.txt`; + ./lint_clean_files.sh; - <<: *native_job name: Ubuntu 16.04 diff --git a/clean_files.txt b/clean_files.txt index f0f8457e..32cede56 100644 --- a/clean_files.txt +++ b/clean_files.txt @@ -1 +1,2 @@ +lint_clean_files.sh themes/90210/90210.theme.bash diff --git a/lint_clean_files.sh b/lint_clean_files.sh new file mode 100755 index 00000000..a6d3cb92 --- /dev/null +++ b/lint_clean_files.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# Pull list of checkable files from clean_files.txt +# +mapfile -t FILES < clean_files.txt + +pre-commit run --files "${FILES[@]}" From a858e75456097507b4ca17a15bed46c165ae8d8d Mon Sep 17 00:00:00 2001 From: David Farrell Date: Tue, 3 Nov 2020 16:14:02 -0800 Subject: [PATCH 34/68] Add Dir Support to Clean_Files; Clean powerline theme --- clean_files.txt | 29 +- lint_clean_files.sh | 13 +- themes/powerline/powerline.base.bash | 416 +++++++++++++------------- themes/powerline/powerline.theme.bash | 1 + 4 files changed, 247 insertions(+), 212 deletions(-) diff --git a/clean_files.txt b/clean_files.txt index 32cede56..0276d20b 100644 --- a/clean_files.txt +++ b/clean_files.txt @@ -1,2 +1,29 @@ +####################################################################### +# Allow-list of files to be lint-checked by CI +# +# Directory Suport +# Directory references are allowed within the file, ie: +# +# themes/powerline +# +# All files under the referenced directory will be checked +# +# Checking Files Locally +# You can manually invoke the check via: +# +# lint_clean_files.sh +# + +# root directories +# +docs + +# root files +# +.gitattributes lint_clean_files.sh -themes/90210/90210.theme.bash + +# themes +# +themes/90210 +themes/powerline diff --git a/lint_clean_files.sh b/lint_clean_files.sh index a6d3cb92..bd34540a 100755 --- a/lint_clean_files.sh +++ b/lint_clean_files.sh @@ -1,7 +1,16 @@ #!/usr/bin/env bash # Pull list of checkable files from clean_files.txt +# - Folder references are allowed +# - Empty lines are ignored +# - Comment lines (#) are ignored # -mapfile -t FILES < clean_files.txt +# shellcheck disable=SC2002 # Prefer 'cat' for cleaner script +mapfile -t FILES < <( + cat clean_files.txt \ + | grep -v -E '^\s*$' \ + | grep -v -E '^\s*#' \ + | xargs -n1 -I{} find "{}" -type f +) -pre-commit run --files "${FILES[@]}" +BASH_IT='' pre-commit run --files "${FILES[@]}" diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index 3655e851..b2596793 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -1,282 +1,280 @@ # Define this here so it can be used by all of the Powerline themes THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=true} -function set_color { - set +u - if [[ "${1}" != "-" ]]; then - fg="38;5;${1}" - fi - if [[ "${2}" != "-" ]]; then - bg="48;5;${2}" - [[ -n "${fg}" ]] && bg=";${bg}" - fi - echo -e "\[\033[${fg}${bg}m\]" +function set_color() { + set +u + if [[ "${1}" != "-" ]]; then + fg="38;5;${1}" + fi + if [[ "${2}" != "-" ]]; then + bg="48;5;${2}" + [[ -n "${fg}" ]] && bg=";${bg}" + fi + echo -e "\[\033[${fg}${bg}m\]" } -function __powerline_user_info_prompt { - local user_info="" - local color=${USER_INFO_THEME_PROMPT_COLOR} +function __powerline_user_info_prompt() { + local user_info="" + local color=${USER_INFO_THEME_PROMPT_COLOR} - if [[ "${THEME_CHECK_SUDO}" = true ]]; then - sudo -vn 1>/dev/null 2>&1 && color=${USER_INFO_THEME_PROMPT_COLOR_SUDO} - fi + if [[ "${THEME_CHECK_SUDO}" = true ]]; then + sudo -vn 1> /dev/null 2>&1 && color=${USER_INFO_THEME_PROMPT_COLOR_SUDO} + fi - case "${POWERLINE_PROMPT_USER_INFO_MODE}" in - "sudo") - if [[ "${color}" = "${USER_INFO_THEME_PROMPT_COLOR_SUDO}" ]]; then - user_info="!" - fi - ;; - *) - local user=${SHORT_USER:-${USER}} - if [[ -n "${SSH_CLIENT}" ]] || [[ -n "${SSH_CONNECTION}" ]]; then - user_info="${USER_INFO_SSH_CHAR}${user}" - else - user_info="${user}" - fi - ;; - esac - [[ -n "${user_info}" ]] && echo "${user_info}|${color}" + case "${POWERLINE_PROMPT_USER_INFO_MODE}" in + "sudo") + if [[ "${color}" = "${USER_INFO_THEME_PROMPT_COLOR_SUDO}" ]]; then + user_info="!" + fi + ;; + *) + local user=${SHORT_USER:-${USER}} + if [[ -n "${SSH_CLIENT}" ]] || [[ -n "${SSH_CONNECTION}" ]]; then + user_info="${USER_INFO_SSH_CHAR}${user}" + else + user_info="${user}" + fi + ;; + esac + [[ -n "${user_info}" ]] && echo "${user_info}|${color}" } -function __powerline_terraform_prompt { - local terraform_workspace="" +function __powerline_terraform_prompt() { + local terraform_workspace="" - if [ -d .terraform ]; then - terraform_workspace="$(terraform_workspace_prompt)" - [[ -n "${terraform_workspace}" ]] && echo "${TERRAFORM_CHAR}${terraform_workspace}|${TERRAFORM_THEME_PROMPT_COLOR}" - fi + if [ -d .terraform ]; then + terraform_workspace="$(terraform_workspace_prompt)" + [[ -n "${terraform_workspace}" ]] && echo "${TERRAFORM_CHAR}${terraform_workspace}|${TERRAFORM_THEME_PROMPT_COLOR}" + fi } -function __powerline_node_prompt { - local node_version="" +function __powerline_node_prompt() { + local node_version="" - node_version="$(node_version_prompt)" - [[ -n "${node_version}" ]] && echo "${NODE_CHAR}${node_version}|${NODE_THEME_PROMPT_COLOR}" + node_version="$(node_version_prompt)" + [[ -n "${node_version}" ]] && echo "${NODE_CHAR}${node_version}|${NODE_THEME_PROMPT_COLOR}" } -function __powerline_ruby_prompt { - local ruby_version="" +function __powerline_ruby_prompt() { + local ruby_version="" - if _command_exists rvm; then - ruby_version="$(rvm_version_prompt)" - elif _command_exists rbenv; then - ruby_version=$(rbenv_version_prompt) - fi + if _command_exists rvm; then + ruby_version="$(rvm_version_prompt)" + elif _command_exists rbenv; then + ruby_version=$(rbenv_version_prompt) + fi - [[ -n "${ruby_version}" ]] && echo "${RUBY_CHAR}${ruby_version}|${RUBY_THEME_PROMPT_COLOR}" + [[ -n "${ruby_version}" ]] && echo "${RUBY_CHAR}${ruby_version}|${RUBY_THEME_PROMPT_COLOR}" } -function __powerline_k8s_context_prompt { - local kubernetes_context="" +function __powerline_k8s_context_prompt() { + local kubernetes_context="" - if _command_exists kubectl; then - kubernetes_context="$(k8s_context_prompt)" - fi + if _command_exists kubectl; then + kubernetes_context="$(k8s_context_prompt)" + fi - [[ -n "${kubernetes_context}" ]] && echo "${KUBERNETES_CONTEXT_THEME_CHAR}${kubernetes_context}|${KUBERNETES_CONTEXT_THEME_PROMPT_COLOR}" + [[ -n "${kubernetes_context}" ]] && echo "${KUBERNETES_CONTEXT_THEME_CHAR}${kubernetes_context}|${KUBERNETES_CONTEXT_THEME_PROMPT_COLOR}" } -function __powerline_python_venv_prompt { - set +u - local python_venv="" +function __powerline_python_venv_prompt() { + set +u + local python_venv="" - if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then - python_venv="${CONDA_DEFAULT_ENV}" - PYTHON_VENV_CHAR=${CONDA_PYTHON_VENV_CHAR} - elif [[ -n "${VIRTUAL_ENV}" ]]; then - python_venv=$(basename "${VIRTUAL_ENV}") - fi + if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then + python_venv="${CONDA_DEFAULT_ENV}" + PYTHON_VENV_CHAR=${CONDA_PYTHON_VENV_CHAR} + elif [[ -n "${VIRTUAL_ENV}" ]]; then + python_venv=$(basename "${VIRTUAL_ENV}") + fi - [[ -n "${python_venv}" ]] && echo "${PYTHON_VENV_CHAR}${python_venv}|${PYTHON_VENV_THEME_PROMPT_COLOR}" + [[ -n "${python_venv}" ]] && echo "${PYTHON_VENV_CHAR}${python_venv}|${PYTHON_VENV_THEME_PROMPT_COLOR}" } -function __powerline_scm_prompt { - local color="" - local scm_prompt="" +function __powerline_scm_prompt() { + local color="" + local scm_prompt="" - scm_prompt_vars + scm_prompt_vars - if [[ "${SCM_NONE_CHAR}" != "${SCM_CHAR}" ]]; then - if [[ "${SCM_DIRTY}" -eq 3 ]]; then - color=${SCM_THEME_PROMPT_STAGED_COLOR} - elif [[ "${SCM_DIRTY}" -eq 2 ]]; then - color=${SCM_THEME_PROMPT_UNSTAGED_COLOR} - elif [[ "${SCM_DIRTY}" -eq 1 ]]; then - color=${SCM_THEME_PROMPT_DIRTY_COLOR} - else - color=${SCM_THEME_PROMPT_CLEAN_COLOR} - fi - if [[ "${SCM_GIT_CHAR}" == "${SCM_CHAR}" ]]; then - scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" - elif [[ "${SCM_P4_CHAR}" == "${SCM_CHAR}" ]]; then - scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" - elif [[ "${SCM_HG_CHAR}" == "${SCM_CHAR}" ]]; then - scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" - elif [[ "${SCM_SVN_CHAR}" == "${SCM_CHAR}" ]]; then - scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" - fi - echo "$(eval "echo ${scm_prompt}")${scm}|${color}" - fi + if [[ "${SCM_NONE_CHAR}" != "${SCM_CHAR}" ]]; then + if [[ "${SCM_DIRTY}" -eq 3 ]]; then + color=${SCM_THEME_PROMPT_STAGED_COLOR} + elif [[ "${SCM_DIRTY}" -eq 2 ]]; then + color=${SCM_THEME_PROMPT_UNSTAGED_COLOR} + elif [[ "${SCM_DIRTY}" -eq 1 ]]; then + color=${SCM_THEME_PROMPT_DIRTY_COLOR} + else + color=${SCM_THEME_PROMPT_CLEAN_COLOR} + fi + if [[ "${SCM_GIT_CHAR}" == "${SCM_CHAR}" ]]; then + scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" + elif [[ "${SCM_P4_CHAR}" == "${SCM_CHAR}" ]]; then + scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" + elif [[ "${SCM_HG_CHAR}" == "${SCM_CHAR}" ]]; then + scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" + elif [[ "${SCM_SVN_CHAR}" == "${SCM_CHAR}" ]]; then + scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" + fi + echo "$(eval "echo ${scm_prompt}")${scm}|${color}" + fi } -function __powerline_cwd_prompt { - local cwd=$(pwd | sed "s|^${HOME}|~|") +function __powerline_cwd_prompt() { + local cwd=$(pwd | sed "s|^${HOME}|~|") - echo "${cwd}|${CWD_THEME_PROMPT_COLOR}" + echo "${cwd}|${CWD_THEME_PROMPT_COLOR}" } -function __powerline_hostname_prompt { - echo "${SHORT_HOSTNAME:-$(hostname -s)}|${HOST_THEME_PROMPT_COLOR}" +function __powerline_hostname_prompt() { + echo "${SHORT_HOSTNAME:-$(hostname -s)}|${HOST_THEME_PROMPT_COLOR}" } -function __powerline_wd_prompt { - echo "\W|${CWD_THEME_PROMPT_COLOR}" +function __powerline_wd_prompt() { + echo "\W|${CWD_THEME_PROMPT_COLOR}" } -function __powerline_clock_prompt { - echo "$(date +"${THEME_CLOCK_FORMAT}")|${CLOCK_THEME_PROMPT_COLOR}" +function __powerline_clock_prompt() { + echo "$(date +"${THEME_CLOCK_FORMAT}")|${CLOCK_THEME_PROMPT_COLOR}" } -function __powerline_battery_prompt { - local color="" - local battery_status="$(battery_percentage 2> /dev/null)" +function __powerline_battery_prompt() { + local color="" + local battery_status="$(battery_percentage 2> /dev/null)" - if [[ -z "${battery_status}" ]] || [[ "${battery_status}" = "-1" ]] || [[ "${battery_status}" = "no" ]]; then - true - else - if [[ "$((10#${battery_status}))" -le 5 ]]; then - color="${BATTERY_STATUS_THEME_PROMPT_CRITICAL_COLOR}" - elif [[ "$((10#${battery_status}))" -le 25 ]]; then - color="${BATTERY_STATUS_THEME_PROMPT_LOW_COLOR}" - else - color="${BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR}" - fi - ac_adapter_connected && battery_status="${BATTERY_AC_CHAR}${battery_status}" - echo "${battery_status}%|${color}" - fi + if [[ -z "${battery_status}" ]] || [[ "${battery_status}" = "-1" ]] || [[ "${battery_status}" = "no" ]]; then + true + else + if [[ "$((10#${battery_status}))" -le 5 ]]; then + color="${BATTERY_STATUS_THEME_PROMPT_CRITICAL_COLOR}" + elif [[ "$((10#${battery_status}))" -le 25 ]]; then + color="${BATTERY_STATUS_THEME_PROMPT_LOW_COLOR}" + else + color="${BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR}" + fi + ac_adapter_connected && battery_status="${BATTERY_AC_CHAR}${battery_status}" + echo "${battery_status}%|${color}" + fi } -function __powerline_in_vim_prompt { - if [ -n "$VIMRUNTIME" ]; then - echo "${IN_VIM_THEME_PROMPT_TEXT}|${IN_VIM_THEME_PROMPT_COLOR}" - fi +function __powerline_in_vim_prompt() { + if [ -n "$VIMRUNTIME" ]; then + echo "${IN_VIM_THEME_PROMPT_TEXT}|${IN_VIM_THEME_PROMPT_COLOR}" + fi } -function __powerline_aws_profile_prompt { - if [[ -n "${AWS_PROFILE}" ]]; then - echo "${AWS_PROFILE_CHAR}${AWS_PROFILE}|${AWS_PROFILE_PROMPT_COLOR}" - fi +function __powerline_aws_profile_prompt() { + if [[ -n "${AWS_PROFILE}" ]]; then + echo "${AWS_PROFILE_CHAR}${AWS_PROFILE}|${AWS_PROFILE_PROMPT_COLOR}" + fi } -function __powerline_shlvl_prompt { - if [[ "${SHLVL}" -gt 1 ]]; then - local prompt="${SHLVL_THEME_PROMPT_CHAR}" - local level=$(( ${SHLVL} - 1)) - echo "${prompt}${level}|${SHLVL_THEME_PROMPT_COLOR}" - fi +function __powerline_shlvl_prompt() { + if [[ "${SHLVL}" -gt 1 ]]; then + local prompt="${SHLVL_THEME_PROMPT_CHAR}" + local level=$((SHLVL - 1)) + echo "${prompt}${level}|${SHLVL_THEME_PROMPT_COLOR}" + fi } -function __powerline_dirstack_prompt { - if [[ "${#DIRSTACK[@]}" -gt 1 ]]; then - local depth=$(( ${#DIRSTACK[@]} - 1 )) - local prompt="${DIRSTACK_THEME_PROMPT_CHAR}" - if [[ "${depth}" -ge 2 ]]; then - prompt+="${depth}" - fi - echo "${prompt}|${DIRSTACK_THEME_PROMPT_COLOR}" - fi +function __powerline_dirstack_prompt() { + if [[ "${#DIRSTACK[@]}" -gt 1 ]]; then + local depth=$((${#DIRSTACK[@]} - 1)) + local prompt="${DIRSTACK_THEME_PROMPT_CHAR}" + if [[ "${depth}" -ge 2 ]]; then + prompt+="${depth}" + fi + echo "${prompt}|${DIRSTACK_THEME_PROMPT_COLOR}" + fi } -function __powerline_history_number_prompt { - echo "${HISTORY_NUMBER_THEME_PROMPT_CHAR}\!|${HISTORY_NUMBER_THEME_PROMPT_COLOR}" +function __powerline_history_number_prompt() { + echo "${HISTORY_NUMBER_THEME_PROMPT_CHAR}\!|${HISTORY_NUMBER_THEME_PROMPT_COLOR}" } -function __powerline_command_number_prompt { - echo "${COMMAND_NUMBER_THEME_PROMPT_CHAR}\#|${COMMAND_NUMBER_THEME_PROMPT_COLOR}" +function __powerline_command_number_prompt() { + echo "${COMMAND_NUMBER_THEME_PROMPT_CHAR}\#|${COMMAND_NUMBER_THEME_PROMPT_COLOR}" } -function __powerline_left_segment { - local OLD_IFS="${IFS}"; IFS="|" - local params=( $1 ) - IFS="${OLD_IFS}" - local pad_before_segment=" " +function __powerline_left_segment() { + local params + IFS="|" read -ra params <<< "${1}" + local pad_before_segment=" " - if [[ "${SEGMENTS_AT_LEFT}" -eq 0 ]]; then - if [[ "${POWERLINE_COMPACT_BEFORE_FIRST_SEGMENT}" -ne 0 ]]; then - pad_before_segment="" - fi - else - if [[ "${POWERLINE_COMPACT_AFTER_SEPARATOR}" -ne 0 ]]; then - pad_before_segment="" - fi - # Since the previous segment wasn't the last segment, add padding, if needed - # - if [[ "${POWERLINE_COMPACT_BEFORE_SEPARATOR}" -eq 0 ]]; then - LEFT_PROMPT+="$(set_color - ${LAST_SEGMENT_COLOR}) ${normal}" - fi - if [[ "${LAST_SEGMENT_COLOR}" -eq "${params[1]}" ]]; then - LEFT_PROMPT+="$(set_color - ${LAST_SEGMENT_COLOR})${POWERLINE_LEFT_SEPARATOR_SOFT}${normal}" - else - LEFT_PROMPT+="$(set_color ${LAST_SEGMENT_COLOR} ${params[1]})${POWERLINE_LEFT_SEPARATOR}${normal}" - fi - fi + if [[ "${SEGMENTS_AT_LEFT}" -eq 0 ]]; then + if [[ "${POWERLINE_COMPACT_BEFORE_FIRST_SEGMENT}" -ne 0 ]]; then + pad_before_segment="" + fi + else + if [[ "${POWERLINE_COMPACT_AFTER_SEPARATOR}" -ne 0 ]]; then + pad_before_segment="" + fi + # Since the previous segment wasn't the last segment, add padding, if needed + # + if [[ "${POWERLINE_COMPACT_BEFORE_SEPARATOR}" -eq 0 ]]; then + LEFT_PROMPT+="$(set_color - "${LAST_SEGMENT_COLOR}") ${normal}" + fi + if [[ "${LAST_SEGMENT_COLOR}" -eq "${params[1]}" ]]; then + LEFT_PROMPT+="$(set_color - "${LAST_SEGMENT_COLOR}")${POWERLINE_LEFT_SEPARATOR_SOFT}${normal}" + else + LEFT_PROMPT+="$(set_color "${LAST_SEGMENT_COLOR}" "${params[1]}")${POWERLINE_LEFT_SEPARATOR}${normal}" + fi + fi - LEFT_PROMPT+="$(set_color - ${params[1]})${pad_before_segment}${params[0]}${normal}" - LAST_SEGMENT_COLOR=${params[1]} - (( SEGMENTS_AT_LEFT += 1 )) + LEFT_PROMPT+="$(set_color - "${params[1]}")${pad_before_segment}${params[0]}${normal}" + LAST_SEGMENT_COLOR=${params[1]} + ((SEGMENTS_AT_LEFT += 1)) } -function __powerline_left_last_segment_padding { - LEFT_PROMPT+="$(set_color - ${LAST_SEGMENT_COLOR}) ${normal}" +function __powerline_left_last_segment_padding() { + LEFT_PROMPT+="$(set_color - "${LAST_SEGMENT_COLOR}") ${normal}" } -function __powerline_last_status_prompt { - [[ "$1" -ne 0 ]] && echo "${1}|${LAST_STATUS_THEME_PROMPT_COLOR}" +function __powerline_last_status_prompt() { + [[ "$1" -ne 0 ]] && echo "${1}|${LAST_STATUS_THEME_PROMPT_COLOR}" } -function __powerline_prompt_command { - local last_status="$?" ## always the first - local separator_char="${POWERLINE_PROMPT_CHAR}" +function __powerline_prompt_command() { + local last_status="$?" ## always the first + local separator_char="${POWERLINE_PROMPT_CHAR}" - LEFT_PROMPT="" - SEGMENTS_AT_LEFT=0 - LAST_SEGMENT_COLOR="" + LEFT_PROMPT="" + SEGMENTS_AT_LEFT=0 + LAST_SEGMENT_COLOR="" + if [[ -n "${POWERLINE_PROMPT_DISTRO_LOGO}" ]]; then + LEFT_PROMPT+="$(set_color "${PROMPT_DISTRO_LOGO_COLOR}" "${PROMPT_DISTRO_LOGO_COLORBG}")${PROMPT_DISTRO_LOGO}$(set_color - -)" + fi - if [[ -n "${POWERLINE_PROMPT_DISTRO_LOGO}" ]]; then - LEFT_PROMPT+="$(set_color ${PROMPT_DISTRO_LOGO_COLOR} ${PROMPT_DISTRO_LOGO_COLORBG})${PROMPT_DISTRO_LOGO}$(set_color - -)" - fi + ## left prompt ## + for segment in $POWERLINE_PROMPT; do + local info="$(__powerline_"${segment}"_prompt)" + [[ -n "${info}" ]] && __powerline_left_segment "${info}" + done - ## left prompt ## - for segment in $POWERLINE_PROMPT; do - local info="$(__powerline_${segment}_prompt)" - [[ -n "${info}" ]] && __powerline_left_segment "${info}" - done + [[ "${last_status}" -ne 0 ]] && __powerline_left_segment "$(__powerline_last_status_prompt ${last_status})" - [[ "${last_status}" -ne 0 ]] && __powerline_left_segment $(__powerline_last_status_prompt ${last_status}) + if [[ -n "${LEFT_PROMPT}" ]] && [[ "${POWERLINE_COMPACT_AFTER_LAST_SEGMENT}" -eq 0 ]]; then + __powerline_left_last_segment_padding + fi - if [[ -n "${LEFT_PROMPT}" ]] && [[ "${POWERLINE_COMPACT_AFTER_LAST_SEGMENT}" -eq 0 ]]; then - __powerline_left_last_segment_padding - fi + # By default we try to match the prompt to the adjacent segment's background color, + # but when part of the prompt exists within that segment, we instead match the foreground color. + local prompt_color="$(set_color "${LAST_SEGMENT_COLOR}" -)" + if [[ -n "${LEFT_PROMPT}" ]] && [[ -n "${POWERLINE_LEFT_LAST_SEGMENT_PROMPT_CHAR}" ]]; then + LEFT_PROMPT+="$(set_color - "${LAST_SEGMENT_COLOR}")${POWERLINE_LEFT_LAST_SEGMENT_PROMPT_CHAR}" + prompt_color="${normal}" + fi + [[ -n "${LEFT_PROMPT}" ]] && LEFT_PROMPT+="${prompt_color}${separator_char}${normal}" - # By default we try to match the prompt to the adjacent segment's background color, - # but when part of the prompt exists within that segment, we instead match the foreground color. - local prompt_color="$(set_color ${LAST_SEGMENT_COLOR} -)" - if [[ -n "${LEFT_PROMPT}" ]] && [[ -n "${POWERLINE_LEFT_LAST_SEGMENT_PROMPT_CHAR}" ]]; then - LEFT_PROMPT+="$(set_color - ${LAST_SEGMENT_COLOR})${POWERLINE_LEFT_LAST_SEGMENT_PROMPT_CHAR}" - prompt_color="${normal}" - fi - [[ -n "${LEFT_PROMPT}" ]] && LEFT_PROMPT+="${prompt_color}${separator_char}${normal}" + if [[ "${POWERLINE_COMPACT_PROMPT}" -eq 0 ]]; then + LEFT_PROMPT+=" " + fi - if [[ "${POWERLINE_COMPACT_PROMPT}" -eq 0 ]]; then - LEFT_PROMPT+=" " - fi + PS1="${LEFT_PROMPT}" - PS1="${LEFT_PROMPT}" - - ## cleanup ## - unset LAST_SEGMENT_COLOR \ - LEFT_PROMPT \ - SEGMENTS_AT_LEFT + ## cleanup ## + unset LAST_SEGMENT_COLOR \ + LEFT_PROMPT \ + SEGMENTS_AT_LEFT } diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index d897c7c8..1463d777 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -1,5 +1,6 @@ #!/usr/bin/env bash +# shellcheck source=../../themes/powerline/powerline.base.bash . "$BASH_IT/themes/powerline/powerline.base.bash" PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""} From ff208775a5e0111e3f90f1d3b55ea9693a08854d Mon Sep 17 00:00:00 2001 From: David Farrell Date: Thu, 5 Nov 2020 08:28:33 -0800 Subject: [PATCH 35/68] Explain Bash-it variable clearing in lint script --- lint_clean_files.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lint_clean_files.sh b/lint_clean_files.sh index bd34540a..9a5a5cae 100755 --- a/lint_clean_files.sh +++ b/lint_clean_files.sh @@ -13,4 +13,11 @@ mapfile -t FILES < <( | xargs -n1 -I{} find "{}" -type f ) +# We clear the BASH_IT variable to help the schellcheck checker +# identify source includes within our scripts that require a +# 'source' directive. For more information, see: +# +# "Shellcheck SC1090 - Can't follow non-constant source" +# https://www.shellcheck.net/wiki/SC1090 +# BASH_IT='' pre-commit run --files "${FILES[@]}" From 75bd5c85c186738ea620bad007dac8e25d877627 Mon Sep 17 00:00:00 2001 From: David Farrell Date: Thu, 5 Nov 2020 08:28:33 -0800 Subject: [PATCH 36/68] Explain Bash-it variable clearing in lint script --- lint_clean_files.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lint_clean_files.sh b/lint_clean_files.sh index bd34540a..26650b16 100755 --- a/lint_clean_files.sh +++ b/lint_clean_files.sh @@ -13,4 +13,11 @@ mapfile -t FILES < <( | xargs -n1 -I{} find "{}" -type f ) +# We clear the BASH_IT variable to help the shellcheck checker +# identify source includes within our scripts that require a +# 'source' directive. For more information, see: +# +# "Shellcheck SC1090 - Can't follow non-constant source" +# https://www.shellcheck.net/wiki/SC1090 +# BASH_IT='' pre-commit run --files "${FILES[@]}" From 621ac92ae1be2a9982ec5be446f9069dc4aba023 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Wed, 28 Oct 2020 15:25:52 +0200 Subject: [PATCH 37/68] Migrate wiki docs to rtd format --- docs/index.rst | 2 + docs/themes-list/index.rst | 558 +++++++++++++++++++++++++++++++++++++ docs/themes.rst | 35 +++ docs/troubleshooting.rst | 16 ++ 4 files changed, 611 insertions(+) create mode 100644 docs/themes-list/index.rst create mode 100644 docs/troubleshooting.rst diff --git a/docs/index.rst b/docs/index.rst index 7f4649e7..e5bc2667 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -21,8 +21,10 @@ Stop polluting your ``~/bin`` directory and your ``.bashrc`` file, fork/clone Ba commands/index custom themes + themes-list/index vcs_user misc + troubleshooting uninstalling diff --git a/docs/themes-list/index.rst b/docs/themes-list/index.rst new file mode 100644 index 00000000..0df4c087 --- /dev/null +++ b/docs/themes-list/index.rst @@ -0,0 +1,558 @@ +.. _list_of_themes: + +List of Themes +============== + +Below is a list of all of the themes (with screenshots) that `bash-it `_ ships with. + +Alphabetical List: +------------------ + +Bakke +^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/bakke-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/bakke-black.jpg + :alt: Bakke + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/bakke-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/bakke-white.jpg + :alt: Bakke + + +---- + +BarbUk +^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/BarbUk-black.png + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/BarbUk-black.png + :alt: BarbUk + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/BarbUk-white.png + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/BarbUk-white.png + :alt: BarbUk + + +---- + +Bobby +^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/bobby-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/bobby-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/bobby-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/bobby-white.jpg + :alt: + + +---- + +Brunton +^^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/brunton-black.png + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/brunton-black.png + :alt: + + +---- + +Candy +^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/candy-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/candy-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/candy-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/candy-white.jpg + :alt: + + +---- + +Clean +^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/clean-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/clean-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/clean-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/clean-white.jpg + :alt: + + +---- + +Demula +^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/demula-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/demula-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/demula-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/demula-white.jpg + :alt: + + +---- + +DOS +^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/dos-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/dos-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/dos-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/dos-white.jpg + :alt: + + +---- + +DoubleTime +^^^^^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime-white.jpg + :alt: + + +---- + +DoubleTime Multiline +^^^^^^^^^^^^^^^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime_multiline-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime_multiline-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime_multiline-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime_multiline-white.jpg + :alt: + + +---- + +Doubletime Multiline Python Only +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime_multiline_pyonly-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime_multiline_pyonly-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime_multiline_pyonly-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime_multiline_pyonly-white.jpg + :alt: + + +---- + +Envy +^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/envy-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/envy-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/envy-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/envy-white.jpg + :alt: + + +---- + +Iterate +^^^^^^^ + +Responsively wraps prompt based on terminal width. + + +.. image:: https://cloud.githubusercontent.com/assets/1319655/2923152/3a763194-d70e-11e3-9e52-3740de9bbb9b.png + :target: https://cloud.githubusercontent.com/assets/1319655/2923152/3a763194-d70e-11e3-9e52-3740de9bbb9b.png + :alt: + + +.. image:: https://cloud.githubusercontent.com/assets/1319655/2923143/14b8e0d2-d70e-11e3-9706-f5341fff8e5c.png + :target: https://cloud.githubusercontent.com/assets/1319655/2923143/14b8e0d2-d70e-11e3-9706-f5341fff8e5c.png + :alt: + + +---- + +Mr Briggs +^^^^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/mbriggs-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/mbriggs-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/mbriggs-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/mbriggs-white.jpg + :alt: + + +---- + +Minimal +^^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/minimal-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/minimal-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/minimal-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/minimal-white.jpg + :alt: + + +---- + +Modern +^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/modern-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/modern-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/modern-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/modern-white.jpg + :alt: + + +---- + +Modern T +^^^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/modern-t-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/modern-t-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/modern-t-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/modern-t-white.jpg + :alt: + + +---- + +Metal +^^^^^ + + +.. image:: https://raw.githubusercontent.com/jrab66/bash-it/7cc82b518d6286fc68c8477d809ce9f417501976/themes/metal/metalthemeblack.png + :target: https://raw.githubusercontent.com/jrab66/bash-it/7cc82b518d6286fc68c8477d809ce9f417501976/themes/metal/metalthemeblack.png + :alt: + + +---- + +n0Qorg +^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/n0qorg-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/n0qorg-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/n0qorg-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/n0qorg-white.jpg + :alt: + + +---- + +NWinkler +^^^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/nwinkler-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/nwinkler-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/nwinkler-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/nwinkler-white.jpg + :alt: + + +---- + +Pete +^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/pete-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/pete-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/pete-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/pete-white.jpg + :alt: + + +---- + +Powerline +^^^^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-white.jpg + :alt: + + +---- + +Powerline Naked +^^^^^^^^^^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-naked-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-naked-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-naked-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-naked-white.jpg + :alt: + + +---- + +Powerline Plain +^^^^^^^^^^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-plain-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-plain-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-plain-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-plain-white.jpg + :alt: + + +---- + +Pure +^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/pure-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/pure-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/pure-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/pure-white.jpg + :alt: + + +---- + +RainbowBrite +^^^^^^^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/rainbowbrite-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/rainbowbrite-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/rainbowbrite-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/rainbowbrite-white.jpg + :alt: + + +---- + +R Jorgenson +^^^^^^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/rjorgenson-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/rjorgenson-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/rjorgenson-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/rjorgenson-white.jpg + :alt: + + +---- + +Sexy +^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/sexy-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/sexy-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/sexy-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/sexy-white.jpg + :alt: + + +---- + +Simple +^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/simple-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/simple-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/simple-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/simple-white.jpg + :alt: + + +---- + +SirUp +^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/sirup-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/sirup-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/sirup-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/sirup-white.jpg + :alt: + + +---- + +Standard +^^^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/standard-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/standard-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/standard-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/standard-white.jpg + :alt: + + +---- + +Tonka +^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/tonka-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/tonka-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/tonka-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/tonka-white.jpg + :alt: + + +---- + +Tylenol +^^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/tylenol-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/tylenol-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/tylenol-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/tylenol-white.jpg + :alt: + + +---- + +Zitron +^^^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/zitron-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/zitron-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/zitron-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/zitron-white.jpg + :alt: + + +---- + +Zork +^^^^ + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/zork-black.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/zork-black.jpg + :alt: + + +.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/zork-white.jpg + :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/zork-white.jpg + :alt: diff --git a/docs/themes.rst b/docs/themes.rst index 27b93a29..aa21a7e3 100644 --- a/docs/themes.rst +++ b/docs/themes.rst @@ -29,6 +29,41 @@ You can see theme screenshots on `wiki/Themes `. + +Theme Switches & Variables +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Clock Related +============= + +function: ``clock_char`` +######################## + +Prints a character indicating clock. + + +* ``THEME_SHOW_CLOCK_CHAR`` : **true**\ /false + +* ``THEME_CLOCK_CHAR`` : "\ **⌚**\ " + +* ``THEME_CLOCK_CHAR_COLOR`` : "\ **$normal**\ " + +function: ``clock_prompt`` +########################## + +Prints the clock prompt (date, time). + + +* ``THEME_SHOW_CLOCK`` : **true**\ /false + +* ``THEME_CLOCK_COLOR`` : "\ **$normal**\ " + +* ``THEME_CLOCK_FORMAT`` : "\ **%H:%M:%S**\ " + Contributing a new theme ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst new file mode 100644 index 00000000..6503699a --- /dev/null +++ b/docs/troubleshooting.rst @@ -0,0 +1,16 @@ +.. _troubleshooting: + +Troubleshooting Guide +===================== + +Table of Contents +----------------- + +* `I'm stuck in the LightDM login screen after setting up bash-it. `_ + +I'm stuck in the LightDM login screen after setting up bash-it +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +**Possible issue**\ : `#672 `_ + +**Solution**\ : Check `this comment `_ for detailed information about the cause and solution for this issue. From 5cdb98f802b76efa88088fce5573907c88719f61 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Thu, 5 Nov 2020 20:45:20 +0200 Subject: [PATCH 38/68] pre-commit: Exclude docs _build folder --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0bd696da..84ed6ee7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,6 +3,7 @@ --- # fail_fast: true minimum_pre_commit_version: 1.18.1 +exclude: "docs/_build/" repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.3.0 From 864970bcd21e31eb1d6d5236a33a9d2832a7a3f7 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Mon, 26 Oct 2020 16:37:43 +0200 Subject: [PATCH 39/68] docs: Transition md files to support new rtd format --- CONTRIBUTING.md | 91 --------- DEVELOPMENT.md | 74 -------- README.md | 494 ++---------------------------------------------- test/README.md | 40 ---- 4 files changed, 19 insertions(+), 680 deletions(-) delete mode 100644 CONTRIBUTING.md delete mode 100644 DEVELOPMENT.md delete mode 100644 test/README.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 8c251c6c..00000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,91 +0,0 @@ -# Contribution Guidelines - -When contributing a new feature, a bug fix, a new theme, or any other change to Bash-it, please consider the following guidelines. -Most of this is common sense, but please try to stick to the conventions listed here. - -## Issues - -* When opening a new issue in the issue tracker, please include information about which _Operating System_ you're using, and which version of _Bash_. -* In many cases, it also makes sense to show which Bash-it plugins you are using. - This information can be obtained using `bash-it show plugins`. -* If the issue happens while loading Bash-it, please also include your `~/.bash_profile` or `~/.bashrc` file, - as well as the install location of Bash-it (default should be `~/.bash_it`). -* When reporting a bug or requesting a new feature, consider providing a Pull Request that fixes the issue or can be used as a starting point for the new feature. - Don't be afraid, most things aren't that complex... - -## Pull Requests - -* Fork the Bash-it repo, create a new feature branch from _master_ and apply your changes there. - Create a _Pull Request_ from your feature branch against Bash-it's _master_ branch. -* Limit each Pull Request to one feature. - Don't bundle multiple features/changes (e.g. a new _Theme_ and a fix to an existing plugin) into a single Pull Request - create one PR for the theme, and a separate PR for the fix. -* For complex changes, try to _squash_ your changes into a single commit before - pushing code. Once you've pushed your code and opened a PR, please refrain - from force-pushing changes to the PR branch – remember, Bash-it is a - distributed project and your branch may be in use already. -* When in doubt, open a PR with too many commits. Bash-it is a learning project - for everyone involved. Showing your work provides a great history for folks - to learn what works and what didn't. - -## Code Style - -* Try to stick to the existing code style. Please don't reformat or change the syntax of existing code simply because you don't like that style. -* Indentation is using spaces, not tabs. Most of the code is indented with 2 spaces, some with 4 spaces. Please try to stick to 2 spaces. - 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`. - Don't use underscores, e.g. `my_new_function`. -* Internal functions that aren't to be used by the end user should start with an underscore, e.g. `_my-new-internal-function`. -* Use the provided meta functions to document your code, e.g. `about-plugin`, `about`, `group`, `param`, `example`. - This will make it easier for other people to use your new functionality. - Take a look at the existing code for an example (e.g. [the base plugin](plugins/available/base.plugin.bash)). -* When adding files, please use the existing file naming conventions, e.g. plugin files need to end in `.plugin.bash`. - This is important for the installation functionality. -* When using the `$BASH_IT` variable, please always enclose it in double quotes to ensure that the code also works when Bash-it is installed in a directory that contains spaces in its name: `for f in "${BASH_IT}/plugins/available"/*.bash ; do echo "$f" ; done` -* Bash-it supports Bash 3.2 and higher. Please don't use features only available in Bash 4, such as associative arrays. - -## Unit Tests - -When adding features or making changes/fixes, please run our growing unit test suite to ensure that you did not break existing functionality. -The test suite does not cover all aspects of Bash-it, but please run it anyway to verify that you did not introduce any regression issues. - -Any code pushed to GitHub as part of a Pull Request will automatically trigger a continuous integration build on [Travis CI](https://travis-ci.org/Bash-it/bash-it), where the test suite is run on both Linux and macOS. -The Pull Request will then show the result of the Travis build, indicating whether all tests ran fine, or whether there were issues. -Please pay attention to this, Pull Requests with build issues will not be merged. - -Adding new functionality or changing existing functionality is a good opportunity to increase Bash-it's test coverage. -When you're changing the Bash-it codebase, please consider adding some unit tests that cover the new or changed functionality. -Ideally, when fixing a bug, a matching unit test that verifies that the bug is no longer present, is added at the same time. - -To run the test suite, simply execute the following in the directory where you cloned Bash-it: - -```bash -test/run -``` - -This command will ensure that the [Bats Test Framework](https://github.com/bats-core/bats-core) is available in the local `test_lib` directory (Bats is included as a Git submodule) and then run the test suite found in the [test](test) folder. -The test script will execute each test in turn, and will print a status for each test case. - -When adding new test cases, please take a look at the existing test cases for examples. - -The following libraries are used to help with the tests: - -* Test Framework: https://github.com/bats-core/bats-core -* Support library for Bats-Assert: https://github.com/ztombol/bats-support -* General `assert` functions: https://github.com/ztombol/bats-assert -* File `assert` functions: https://github.com/ztombol/bats-file - -When verifying test results, please try to use the `assert` functions found in these libraries. - -## Features - -* When adding new completions or plugins, please don't simply copy existing tools into the Bash-it codebase, try to load/integrate the tools instead. - An example is using `nvm`: Instead of copying the existing `nvm` script into Bash-it, the `nvm.plugin.bash` file tries to load an existing installation of `nvm`. - This means an additional step for the user (installing `nvm` from its own repo, or through a package manager), - but it will also ensure that `nvm` can be upgraded in an easy way. - -## 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. - The project's Wiki has a _Themes_ page where you can add a screenshot if you want. -* Ideally, each theme's folder should contain a `README.md` file describing the theme and its configuration options. diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md deleted file mode 100644 index 2f7941cb..00000000 --- a/DEVELOPMENT.md +++ /dev/null @@ -1,74 +0,0 @@ -# Bash-it Development - -This page summarizes a couple of rules to keep in mind when developing features or making changes in Bash-it. - -## Debugging and Logging - -### General Logging - -While developing feature or making changes in general, you can log error/warning/debug -using `_log_error` `_log_warning` and `_log_debug`. This will help you solve problems quicker -and also propagate important notes to other users of Bash-it. -You can see the logs by using `bash-it doctor` command to reload and see the logs. -Alternatively, you can set `BASH_IT_LOG_LEVEL` to `BASH_IT_LOG_LEVEL_ERROR`, `BASH_IT_LOG_LEVEL_WARNING` or `BASH_IT_LOG_LEVEL_ALL`. - -### Log Prefix/Context - -You can define `BASH_IT_LOG_PREFIX` in your files in order to a have a constant prefix before your logs. -Note that we prefer to uses "tags" based logging, i.e `plugins: git: DEBUG: Loading git plugin`. - - -## Load Order - -### General Load Order - -The main `bash_it.sh` script loads the frameworks individual components in the following order: - -* `lib/composure.bash` -* Files in `lib` with the exception of `appearance.bash` - this means that `composure.bash` is loaded again here (possible improvement?) -* Enabled `aliases` -* Enabled `plugins` -* Enabled `completions` -* `themes/colors.theme.bash` -* `themes/base.theme.bash` -* `lib/appearance.bash`, which loads the selected theme -* Custom `aliases` -* Custom `plugins` -* Custom `completions` -* Additional custom files from either `$BASH_IT/custom` or `$BASH_IT_CUSTOM` - -This order is subject to change. - -### Individual Component Load Order - -For `aliases`, `plugins` and `completions`, the following rules are applied that influence the load order: - -* There is a global `enabled` directory, which the enabled components are linked into. Enabled plugins are symlinked from `$BASH_IT/plugins/available` to `$BASH_IT/enabled` for example. All component types are linked into the same common `$BASH_IT/enabled` directory. -* Within the common `enabled` directories, the files are loaded in alphabetical order, which is based on the item's load priority (see next item). -* When enabling a component, a _load priority_ is assigned to the file. The following default priorities are used: - * Aliases: 150 - * Plugins: 250 - * Completions: 350 -* When symlinking a component into the `enabled` directory, the load priority is used as a prefix for the linked name, separated with three dashes from the name of the component. The `node.plugin.bash` would be symlinked to `250---node.plugin.bash` for example. -* Each file can override the default load priority by specifying a new value. To do this, the file needs to include a comment in the following form. This example would cause the `node.plugin.bash` (if included in that file) to be linked to `225---node.plugin.bash`: - - ```bash - # BASH_IT_LOAD_PRIORITY: 225 - ``` - -Having the order based on a numeric priority in a common directory allows for more flexibility. While in general, aliases are loaded first (since their default priority is 150), it's possible to load some aliases after the plugins, or some plugins after completions by setting the items' load priority. This is more flexible than a fixed type-based order or a strict alphabetical order based on name. - -These items are subject to change. When making changes to the internal functionality, this page needs to be updated as well. - -## Plugin Disable Callbacks - -Plugins can define a function that will be called when the plugin is being disabled. -The callback name should be `{PLUGIN_NAME}_on_disable`, you can see `gitstatus` for usage example. - -## Using the pre-commit hook - -Note the file .pre-commit-config.yaml at the top of the repo. -This file configures the behavior of the a pre-commit hook based on [the Pre-Commit framework](https://pre-commit.com/). Please see the site about -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). diff --git a/README.md b/README.md index 1da1f7eb..8867f05a 100644 --- a/README.md +++ b/README.md @@ -13,490 +13,34 @@ If you're using the _Bourne Again Shell_ (Bash) regularly and have been looking Stop polluting your `~/bin` directory and your `.bashrc` file, fork/clone Bash-it and start hacking away. - [Contributing](#contributing) -- [Installation](#installation) - - [Install Options](#install-options) - - [via Docker](#install-using-docker) - - [Updating](#updating) -- [Help](#help-screens) -- [Search](#search) - - [Syntax](#syntax) - - [Searching with Negations](#searching-with-negations) - - [Using Search to Enable or Disable Components](#using-search-to-enable-or-disable-components) - - [Disabling ASCII Color](#disabling-ascii-color) -- [Custom scripts, aliases, themes, and functions](#custom-scripts-aliases-themes-and-functions) -- [Themes](#themes) -- [Uninstalling](#uninstalling) -- [Misc](#misc) -- [Help Out](#help-out) +- [Installation](https://bash-it.readthedocs.io/en/latest/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) +- [Help](https://bash-it.readthedocs.io/en/latest/misc/#help-screens) +- [Search](https://bash-it.readthedocs.io/en/latest/commands/search) + - [Syntax](https://bash-it.readthedocs.io/en/latest/commands/search/#syntax) + - [Searching with Negations]( + https://bash-it.readthedocs.io/en/latest/commands/search/#searching-with-negations) + - [Using Search to Enable or Disable Components](https://bash-it.readthedocs.io/en/latest/commands/search/#using-search-to-enable-or-disable-components) + - [Disabling ASCII Color](https://bash-it.readthedocs.io/en/latest/commands/search/#disabling-ascii-color) +- [Custom scripts, aliases, themes, and functions]( + https://bash-it.readthedocs.io/en/latest/custom) +- [Themes](https://bash-it.readthedocs.io/en/latest/themes) +- [Uninstalling](https://bash-it.readthedocs.io/en/latest/uninstalling) +- [Misc](https://bash-it.readthedocs.io/en/latest/misc) +- [Help Out](https://bash-it.readthedocs.io/en/latest/#help-out) - [Contributors](#contributors) ## Contributing -Please take a look at the [Contribution Guidelines](CONTRIBUTING.md) 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. -The [Development Guidelines](DEVELOPMENT.md) have more information on some of the internal workings of Bash-it, +The [Development Guidelines](https://bash-it.readthedocs.io/en/latest/development) have more information on some of the internal workings of Bash-it, please feel free to read through this page if you're interested in how Bash-it loads its components. -## 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` (it automatically backs up your `~/.bash_profile` or `~/.bashrc`, depending on your OS) -3. Edit your modified config (`~/.bash_profile` or `~/.bashrc`) file in order to customize Bash-it. -4. Check out available aliases, completions, and plugins and enable the ones you want to use (see the next section for more details). - -### Install Options - -The install script can take the following options: - -* `--interactive`: Asks the user which aliases, completions and plugins to enable. -* `--silent`: Ask nothing and install using default settings. -* `--no-modify-config`: Do not modify the existing config file (`~/.bash_profile` or `~/.bashrc`). - -When run without the `--interactive` switch, Bash-it only enables a sane default set of functionality to keep your shell clean and to avoid issues with missing dependencies. -Feel free to enable the tools you want to use after the installation. - -When you run without the `--no-modify-config` switch, the Bash-it installer automatically modifies/replaces your existing config file. -Use the `--no-modify-config` switch to avoid unwanted modifications, e.g. if your Bash config file already contains the code that loads Bash-it. - -**NOTE**: Keep in mind how Bash loads its configuration files, -`.bash_profile` for login shells (and in macOS in terminal emulators like [Terminal.app](http://www.apple.com/osx/apps/) or -[iTerm2](https://www.iterm2.com/)) and `.bashrc` for interactive shells (default mode in most of the GNU/Linux terminal emulators), -to ensure that Bash-it is loaded correctly. -A good "practice" is sourcing `.bashrc` into `.bash_profile` to keep things working in all the scenarios. -To achieve this, you can add this snippet in your `.bash_profile`: - -``` -if [ -f ~/.bashrc ]; then - . ~/.bashrc -fi -``` - -Refer to the official [Bash documentation](https://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files) to get more info. - - -### Install using Docker - -You can try Bash-it in an isolated environment without changing any local files via a [Docker](https://www.docker.com/) Container. -(Bash Shell v4.4 with Bash-it, [bats](https://github.com/sstephenson/bats),and bash-completion based on [Alpine Linux](https://alpinelinux.org/)). - -`docker pull ellerbrock/bash-it` - -Have a look at our [bash-it-docker repository](https://github.com/Bash-it/bash-it-docker) for further information. - - -### Updating - -To update Bash-it to the latest stable version, simply run: - -```bash -bash-it update stable -``` - -If you want to update to the latest dev version (directly from master), run: - -```bash -bash-it update dev -``` - -If you want to update automatically and unattended, you can add the optional -`-s/--silent` flag, for example: - -```bash -bash-it update dev --silent -``` - -If you are using an older version of Bash-it, it's possible that some functionality has changed, or that the internal structure of how Bash-it organizes its functionality has been updated. -For these cases, we provide a `migrate` command: - -```bash -bash-it migrate -``` - -This command will automatically migrate the Bash-it structure to the latest version. -The `migrate` command is run automatically if you run the `update`, `enable` or `disable` commands. - -## Help Screens - -```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 -``` - -## Search - -If you need to quickly find out which of the plugins, aliases or completions are available for a specific framework, programming language, or an environment, you can _search_ for multiple terms related to the commands you use frequently. -Search will find and print out modules with the name or description matching the terms provided. - -### Syntax - -```bash - bash-it search term1 [[-]term2] [[-]term3].... -``` - -As an example, a ruby developer might want to enable everything related to the commands such as `ruby`, `rake`, `gem`, `bundler`, and `rails`. -Search command helps you find related modules so that you can decide which of them you'd like to use: - -```bash -❯ bash-it search ruby rake gem bundle irb rails - aliases: bundler rails - plugins: chruby chruby-auto ruby - completions: bundler gem rake -``` - -Currently enabled modules will be shown in green. - -### Searching with Negations - -You can prefix a search term with a "-" to exclude it from the results. -In the above example, if we wanted to hide `chruby` and `chruby-auto`, -we could change the command as follows: - -```bash -❯ bash-it search ruby rake gem bundle irb rails -chruby - aliases: bundler rails - plugins: ruby - completions: bundler gem rake -``` - -### Using Search to Enable or Disable Components - -By adding a `--enable` or `--disable` to the search command, you can automatically enable all modules that come up as a result of a search query. -This could be quite handy if you like to enable a bunch of components related to the same topic. - -### Disabling ASCII Color - -To remove non-printing non-ASCII characters responsible for the coloring of the search output, you can set environment variable `NO_COLOR`. -Enabled components will then be shown with a checkmark: - -```bash -❯ NO_COLOR=1 bash-it search ruby rake gem bundle irb rails -chruby - aliases => ✓bundler ✓rails - plugins => ✓ruby - completions => bundler gem rake -``` - -## Custom scripts, aliases, themes, and functions - -For custom scripts, and aliases, just create the following files (they'll be ignored by the git repo): - -* `aliases/custom.aliases.bash` -* `completion/custom.completion.bash` -* `lib/custom.bash` -* `plugins/custom.plugins.bash` -* `custom/themes//.theme.bash` - -Anything in the custom directory will be ignored, with the exception of `custom/example.bash`. - -Alternately, if you would like to keep your custom scripts under version control, you can set `BASH_IT_CUSTOM` in your `~/.bashrc` to another location outside of the `$BASH_IT` folder. -In this case, any `*.bash` file under every directory below `BASH_IT_CUSTOM` folder will be used. - -## Themes - -There are over 50+ Bash-it themes to pick from in `$BASH_IT/themes`. -The default theme is `bobby`. -Set `BASH_IT_THEME` to the theme name you want, or if you've developed your own custom theme outside of `$BASH_IT/themes`, -point the `BASH_IT_THEME` variable directly to the theme file. -To disable theming completely, leave the variable empty. - -Examples: - -```bash -# Use the "powerline-multiline" theme -export BASH_IT_THEME="powerline-multiline" - -# Use a theme outside of the Bash-it folder -export BASH_IT_THEME="/home/foo/my_theme/my_theme.theme.bash" - -# Disable theming -export BASH_IT_THEME="" -``` - -You can easily preview the themes in your own shell using `BASH_PREVIEW=true bash-it reload`. - -If you've created your own custom prompts, we'd love it if you shared them with everyone else! Just submit a Pull Request. -You can see theme screenshots on [wiki/Themes](https://github.com/Bash-it/bash-it/wiki/Themes). - -**NOTE**: Bash-it and some themes use UTF-8 characters, so to avoid strange behavior in your terminal, set your locale to `LC_ALL=en_US.UTF-8` or the equivalent to your language if it isn't American English. - -## Uninstalling - -To uninstall Bash-it, run the `uninstall.sh` script found in the `$BASH_IT` directory: - -``` -cd $BASH_IT -./uninstall.sh -``` - -This will restore your previous Bash profile. -After the uninstall script finishes, remove the Bash-it directory from your machine (`rm -rf $BASH_IT`) and start a new shell. - -## Misc - -### Bash Profile Aliases - -Bash-it creates a `reload` alias that makes it convenient to reload -your Bash profile when you make changes. - -Additionally, if you export `BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE` as a non-null value, -Bash-it will automatically reload itself after activating or deactivating plugins, aliases, or completions. - -### Prompt Version Control Check - -Bash-it provides prompt themes with the ability to check and display version control information for the current directory. -The information is retrieved for each directory and can slow down the navigation of projects with a large number of files and folders. -Turn version control checking off to prevent slow directory navigation within large projects. - -Bash-it provides a flag (`SCM_CHECK`) within the `~/.bash_profile` file that turns off/on version control information checking and display within all themes. -Version control checking is on by default unless explicitly turned off. - -Set `SCM_CHECK` to 'false' to **turn off** version control checks for all themes: - -* `export SCM_CHECK=false` - -Set `SCM_CHECK` to 'true' (the default value) to **turn on** version control checks for all themes: - -* `export SCM_CHECK=true` - -**NOTE:** -It is possible for themes to ignore the `SCM_CHECK` flag and query specific version control information directly. -For example, themes that use functions like `git_prompt_vars` skip the `SCM_CHECK` flag to retrieve and display git prompt information. -If you turned version control checking off and you still see version control information within your prompt, then functions like `git_prompt_vars` are most likely the reason why. - -### Git prompt - -Bash-it has some nice features related to Git, continue reading to know more about these features. - -### Repository info in the prompt - -Bash-it can show some information about Git repositories in the shell prompt: the current branch, tag or commit you are at, how many commits the local branch is ahead or behind from the remote branch, and if you have changes stashed. - -Additionally, you can view the status of your working copy and get the count of *staged*, *unstaged* and *untracked* files. -This feature is controlled through the flag `SCM_GIT_SHOW_DETAILS` as follows: - -Set `SCM_GIT_SHOW_DETAILS` to 'true' (the default value) to **show** the working copy details in your prompt: - -* `export SCM_GIT_SHOW_DETAILS=true` - -Set `SCM_GIT_SHOW_DETAILS` to 'false' to **don't show** it: - -* `export SCM_GIT_SHOW_DETAILS=false` - -**NOTE:** If using `SCM_GIT_SHOW_MINIMAL_INFO=true`, then the value of `SCM_GIT_SHOW_DETAILS` is ignored. - -### Remotes and remote branches - -In some git workflows, you must work with various remotes, for this reason, Bash-it can provide some useful information about your remotes and your remote branches, for example, the remote on you are working, or if your local branch is tracking a remote branch. - -You can control this feature with the flag `SCM_GIT_SHOW_REMOTE_INFO` as follows: - -Set `SCM_GIT_SHOW_REMOTE_INFO` to 'auto' (the default value) to activate it only when more than one remote is configured in the current repo: - -* `export SCM_GIT_SHOW_REMOTE_INFO=auto` - -Set `SCM_GIT_SHOW_REMOTE_INFO` to 'true' to always activate the feature: - -* `export SCM_GIT_SHOW_REMOTE_INFO=true` - -Set `SCM_GIT_SHOW_REMOTE_INFO` to 'false' to **disable the feature**: - -* `export SCM_GIT_SHOW_REMOTE_INFO=false` - -**NOTE:** If using `SCM_GIT_SHOW_MINIMAL_INFO=true`, then the value of `SCM_GIT_SHOW_REMOTE_INFO` is ignored. - -### Untracked files - -By default, the `git status` command shows information about *untracked* files. -This behavior can be controlled through command-line flags or git configuration files. -For big repositories, ignoring *untracked* files can make git faster. -Bash-it uses `git status` to gather the repo information it shows in the prompt, so in some circumstances, it can be useful to instruct Bash-it to ignore these files. -You can control this behavior with the flag `SCM_GIT_IGNORE_UNTRACKED`: - -Set `SCM_GIT_IGNORE_UNTRACKED` to 'false' (the default value) to get information about *untracked* files: - -* `export SCM_GIT_IGNORE_UNTRACKED=false` - -Set `SCM_GIT_IGNORE_UNTRACKED` to 'true' to **ignore** *untracked* files: - -* `export SCM_GIT_IGNORE_UNTRACKED=true` - -Also, with this flag to false, Bash-it will not show the repository as dirty when the repo has *untracked* files, and will not display the count of *untracked* files. - -**NOTE:** If you set in git configuration file the option to ignore *untracked* files, this flag has no effect, and Bash-it will ignore *untracked* files always. - -### Stash item count - -When `SCM_GIT_SHOW_DETAILS` is enabled, you can get the count of *stashed* items. This feature can be useful when a user has a lot of stash items. -This feature is controlled through the flag `SCM_GIT_SHOW_STASH_INFO` as follows: - -Set `SCM_GIT_SHOW_STASH_INFO` to 'true' (the default value) to **show** the count of stashed items: - -* `export SCM_GIT_SHOW_STASH_INFO=true` - -Set `SCM_GIT_SHOW_STASH_INFO` to 'false' to **don't show** it: - -* `export SCM_GIT_SHOW_STASH_INFO=false` - -### Ahead/Behind Count - -When displaying information regarding whether or not the local branch is ahead or behind its remote counterpart, you can opt to display the number of commits ahead/behind. -This is useful if you only care whether or not you are ahead or behind and do not care how far ahead/behind you are. - -Set `SCM_GIT_SHOW_COMMIT_COUNT` to 'true' (the default value) to **show** the count of commits ahead/behind: - -* `export SCM_GIT_SHOW_COMMIT_COUNT=true` - -Set `SCM_GIT_SHOW_COMMIT_COUNT` to 'false' to **don't show** it: - -* `export SCM_GIT_SHOW_COMMIT_COUNT=false` - -### Git user - -In some environments, it is useful to know the value of the current git user, which is used to mark all new commits. -For example, any organization that uses the practice of pair programming will typically author each commit with [combined names of the two authors](https://github.com/pivotal/git_scripts). -When another pair uses the same pairing station, the authors are changed at the beginning of the session. - -To get up and running with this technique, run `gem install pivotal_git_scripts`, and then edit your `~/.pairs` file, according to the specification on the [gem's homepage](https://github.com/pivotal/git_scripts). -After that, you should be able to run `git pair kg as` to set the author to, eg. "Konstantin Gredeskoul and Alex Saxby", assuming they've been added to the `~/.pairs` file. -Please see gem's documentation for more information. - -To enable the display of the current pair in the prompt, you must set `SCM_GIT_SHOW_CURRENT_USER` to `true`. -Once set, the `SCM_CURRENT_USER` variable will be automatically populated with the initials of the git author(s). -It will also be included in the default git prompt. -Even if you do not have `git pair` installed, as long as your `user.name` is set, your initials will be computed from your name and shown in the prompt. - -You can control the prefix and the suffix of this component using the two variables: - -* `export SCM_THEME_CURRENT_USER_PREFFIX=' ☺︎ '` - -And - -* `export SCM_THEME_CURRENT_USER_SUFFIX=' ☺︎ '` - -**NOTE:** If using `SCM_GIT_SHOW_MINIMAL_INFO=true`, then the value of `SCM_GIT_SHOW_CURRENT_USER` is ignored. - -### Git show minimal status info - -To speed up the prompt while still getting minimal git status information displayed such as the value of `HEAD` and whether there are any dirty objects, you can set: - -``` -export SCM_GIT_SHOW_MINIMAL_INFO=true -``` - -### Ignore repo status - -When working in repos with a large codebase, Bash-it can slow down your prompt when checking the repo status. -To avoid it, there is an option you can set via Git config to disable checking repo status in Bash-it. - -To disable checking the status in the current repo: - -``` -$ git config --add bash-it.hide-status 1 -``` - -But if you would like to disable it globally, and stop checking the status for all of your repos: - -``` -$ git config --global --add bash-it.hide-status 1 -``` - -Setting this flag globally has the same effect as `SCM_CHECK=true`, but only for Git repos. - -### Speed up git status calculations - -As an alternative to ignoring repo status entirely, you can try out the `gitstatus` plugin. -This plugin speeds up all `git status` calculations by up to 10x times! - -**NOTE**: You will need to clone `gitstatus` repo from [here](https://github.com/romkatv/gitstatus). - -### 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` - -### Debugging - -If you encounter problems with any part of Bash-it, run the following command: -```bash -bash-it doctor -``` -This will reload your bash profile and print out logs of various parts in Bash-it. -Note that this command at default will print all logs, including debug logs. -You can call it like this: -```bash -bash-it doctor [errors/warnings/all] -``` -In order to get wanted verbosity. - -### 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: - -```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 out - -We think everyone has their own custom scripts accumulated over time. -And so, following in the footsteps of oh-my-zsh, Bash-it is a framework for easily customizing your Bash shell. -Everyone's got a custom toolbox, so let's start making them even better, **as a community!** - -Send us a pull request and we'll merge it as long as it looks good. -If you change an existing command, please give an explanation why. -That will help a lot when we merge your changes in. - -Please take a look at the [Contribution Guidelines](CONTRIBUTING.md) before reporting a bug or providing a new feature. - -Thanks, and happing bashing! - - ## Contributors * [List of contributors][contribute] [contribute]: https://github.com/Bash-it/bash-it/contributors -[pass password manager]: http://www.passwordstore.org/ diff --git a/test/README.md b/test/README.md deleted file mode 100644 index 0b19fc0f..00000000 --- a/test/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# Testing with Bats - -## Overview - -The Bash-it unit tests leverage the [Bats unit test framework for Bash](https://github.com/bats-core/bats-core). -There is no need to install Bats explicitly, the test run script will automatically download and install Bats and its dependencies. - -When making changes to Bash-it, the tests are automatically executed in a test build environment on [Travis CI](https://travis-ci.com). - -## Test Execution - -To execute the unit tests, please run the `run` script: - -```bash -# If you are in the `test` directory: -./run - -# If you are in the root `.bash_it` directory: -test/run -``` - -The `run` script will automatically install if it is not already present, and will then run all tests found under the `test` directory, including subdirectories. - -To run only a subset of the tests, you can provide the name of the test subdirectory that you want to run, e.g. like this for the tests in the `test/themes` directory: - -```bash -# If you are in the root `.bash_it` directory: -test/run test/themes -``` - -By default, the tests run in single-threaded mode. -If you want to speed up the test execution, you can install the [GNU `parallel` tool](https://www.gnu.org/software/parallel/), which is supported by Bats. -When using `parallel`, the `test/run` script will use a number of threads in parallel, depending on the available CPU cores of your system. -This can speed up test execution significantly. - -## Writing Tests - -When adding or modifying tests, please stick to the format and conventions of the existing test cases. -The `test_helper.bash` script provides a couple of reusable helper functions that you should use when writing a test case, -for example for setting up an isolated test environment. From 72f5c2ada07c6cc33e19c4dd97eb4b03b6f70393 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Fri, 6 Nov 2020 19:16:47 +0200 Subject: [PATCH 40/68] Move README to be under docs/ --- README.md => docs/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.md => docs/README.md (100%) diff --git a/README.md b/docs/README.md similarity index 100% rename from README.md rename to docs/README.md From 889259dfec3df435539841c188321b64ec804e78 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Sun, 8 Nov 2020 17:33:21 +0200 Subject: [PATCH 41/68] Cut 30s vrom the knife completion init time. --- completion/available/knife.completion.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/completion/available/knife.completion.bash b/completion/available/knife.completion.bash index 6316ce08..def1ccaa 100644 --- a/completion/available/knife.completion.bash +++ b/completion/available/knife.completion.bash @@ -98,7 +98,8 @@ _KAC_clean_cache() } # perform a cache cleaning when loading this file -_KAC_clean_cache +# On big systems this could baloon up to a 30 second run or more, so not enabling by default. +[[ "${KNIFE_CACHE_CLEAN}" ]] && _KAC_clean_cache ##################################### ### End of cache helper functions ### From 689758cf7122b26c9c42e59c93fb56403b0ce282 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Sun, 8 Nov 2020 17:40:45 +0200 Subject: [PATCH 42/68] pre-commit fixes. --- completion/available/knife.completion.bash | 238 ++++++++++----------- 1 file changed, 111 insertions(+), 127 deletions(-) diff --git a/completion/available/knife.completion.bash b/completion/available/knife.completion.bash index def1ccaa..191e428c 100644 --- a/completion/available/knife.completion.bash +++ b/completion/available/knife.completion.bash @@ -31,70 +31,62 @@ stat -c %Y /dev/null > /dev/null 2>&1 && _KAC_STAT_COMMAND="stat -c %Y" || _KAC_ # returns 0 iff the file whose path is given as 1st argument # exists and has last been modified in the last $2 seconds # returns 1 otherwise -_KAC_is_file_newer_than() -{ - [ -f "$1" ] || return 1 - [ $(( $(date +%s) - $($_KAC_STAT_COMMAND "$1") )) -gt $2 ] && return 1 || return 0 +_KAC_is_file_newer_than() { + [ -f "$1" ] || return 1 + [ $(($(date +%s) - $($_KAC_STAT_COMMAND "$1"))) -gt $2 ] && return 1 || return 0 } # helper function for _KAC_get_and_regen_cache, see doc below -_KAC_regen_cache() -{ - local CACHE_NAME=$1 - local CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME" - local TMP_FILE=$(mktemp "$_KAC_CACHE_TMP_DIR/$CACHE_NAME.XXXX") - shift 1 - "$@" > $TMP_FILE 2> /dev/null - # discard the temp file if it's empty AND the previous command didn't exit successfully, but still mark the cache as updated - [[ $? != 0 ]] && [[ $(cat $TMP_FILE | wc -l) == 0 ]] && rm -f $TMP_FILE && touch $CACHE_PATH && return 1 \ - || mv -f $TMP_FILE $CACHE_PATH +_KAC_regen_cache() { + local CACHE_NAME=$1 + local CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME" + local TMP_FILE=$(mktemp "$_KAC_CACHE_TMP_DIR/$CACHE_NAME.XXXX") + shift 1 + "$@" > $TMP_FILE 2> /dev/null + # discard the temp file if it's empty AND the previous command didn't exit successfully, but still mark the cache as updated + [[ $? != 0 ]] && [[ $(cat $TMP_FILE | wc -l) == 0 ]] && rm -f $TMP_FILE && touch $CACHE_PATH && return 1 \ + || mv -f $TMP_FILE $CACHE_PATH } # cached files can't have spaces in their names -_KAC_get_cache_name_from_command() -{ - echo "$@" | sed 's/ /_SPACE_/g' +_KAC_get_cache_name_from_command() { + echo "$@" | sed 's/ /_SPACE_/g' } # the reverse operation from the function above -_KAC_get_command_from_cache_name() -{ - echo "$@" | sed 's/_SPACE_/ /g' +_KAC_get_command_from_cache_name() { + echo "$@" | sed 's/_SPACE_/ /g' } # given a command as argument, it fetches the cache for that command if it can find it # otherwise it waits for the cache to be generated # in either case, it regenerates the cache, and sets the _KAC_CACHE_PATH env variable # for obvious reason, do NOT call that in a sub-shell (in particular, no piping) -_KAC_get_and_regen_cache() -{ - # the cache name can't have space in it - local CACHE_NAME=$(_KAC_get_cache_name_from_command "$@") - local REGEN_CMD="_KAC_regen_cache $CACHE_NAME $@" - _KAC_CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME" - # no need to wait for the regen if the file already exists - [ -f $_KAC_CACHE_PATH ] && ($REGEN_CMD &) || $REGEN_CMD +_KAC_get_and_regen_cache() { + # the cache name can't have space in it + local CACHE_NAME=$(_KAC_get_cache_name_from_command "$@") + local REGEN_CMD="_KAC_regen_cache $CACHE_NAME $@" + _KAC_CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME" + # no need to wait for the regen if the file already exists + [ -f $_KAC_CACHE_PATH ] && ($REGEN_CMD &) || $REGEN_CMD } # performs two things: first, deletes all obsolete temp files # then refreshes stale caches that haven't been called in a long time -_KAC_clean_cache() -{ - local FILE CMD - # delete all obsolete temp files, could be lingering there for any kind of crash in the caching process - for FILE in $(ls $_KAC_CACHE_TMP_DIR) - do - _KAC_is_file_newer_than $FILE $_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE || rm -f $FILE - done - # refresh really stale caches - for FILE in $(find $_KNIFE_AUTOCOMPLETE_CACHE_DIR -maxdepth 1 -type f -not -name '.*') - do - _KAC_is_file_newer_than $FILE $_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE && continue - # first let's get the original command - CMD=$(_KAC_get_command_from_cache_name $(basename "$FILE")) - # then regen the cache - _KAC_get_and_regen_cache "$CMD" > /dev/null - done +_KAC_clean_cache() { + local FILE CMD + # delete all obsolete temp files, could be lingering there for any kind of crash in the caching process + for FILE in $(ls $_KAC_CACHE_TMP_DIR); do + _KAC_is_file_newer_than $FILE $_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE || rm -f $FILE + done + # refresh really stale caches + for FILE in $(find $_KNIFE_AUTOCOMPLETE_CACHE_DIR -maxdepth 1 -type f -not -name '.*'); do + _KAC_is_file_newer_than $FILE $_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE && continue + # first let's get the original command + CMD=$(_KAC_get_command_from_cache_name $(basename "$FILE")) + # then regen the cache + _KAC_get_and_regen_cache "$CMD" > /dev/null + done } # perform a cache cleaning when loading this file @@ -105,103 +97,95 @@ _KAC_clean_cache() ### End of cache helper functions ### ##################################### - # returns all the possible knife sub-commands -_KAC_knife_commands() -{ - knife --help | grep -E "^knife" | sed -E 's/ \(options\)//g' +_KAC_knife_commands() { + knife --help | grep -E "^knife" | sed -E 's/ \(options\)//g' } # rebuilds the knife base command currently being completed, and assigns it to $_KAC_CURRENT_COMMAND # additionnally, returns 1 iff the current base command is not complete, 0 otherwise # also sets $_KAC_CURRENT_COMMAND_NB_WORDS if the base command is complete -_KAC_get_current_base_command() -{ - local PREVIOUS="knife" - local I=1 - local CURRENT - while [ $I -le $COMP_CWORD ] - do - # command words are all lower-case - echo ${COMP_WORDS[$I]} | grep -E "^[a-z]+$" > /dev/null || break - CURRENT="$PREVIOUS ${COMP_WORDS[$I]}" - cat $_KAC_CACHE_PATH | grep -E "^$CURRENT" > /dev/null || break - PREVIOUS=$CURRENT - I=$(( $I + 1)) - done - _KAC_CURRENT_COMMAND=$PREVIOUS - [ $I -le $COMP_CWORD ] && _KAC_CURRENT_COMMAND_NB_WORDS=$I +_KAC_get_current_base_command() { + local PREVIOUS="knife" + local I=1 + local CURRENT + while [ $I -le $COMP_CWORD ]; do + # command words are all lower-case + echo ${COMP_WORDS[$I]} | grep -E "^[a-z]+$" > /dev/null || break + CURRENT="$PREVIOUS ${COMP_WORDS[$I]}" + cat $_KAC_CACHE_PATH | grep -E "^$CURRENT" > /dev/null || break + PREVIOUS=$CURRENT + I=$(($I + 1)) + done + _KAC_CURRENT_COMMAND=$PREVIOUS + [ $I -le $COMP_CWORD ] && _KAC_CURRENT_COMMAND_NB_WORDS=$I } # searches the position of the currently completed argument in the current base command # (i.e. handles "plural" arguments such as knife cookbook upload cookbook1 cookbook2 and so on...) # assumes the current base command is complete -_KAC_get_current_arg_position() -{ - local CURRENT_ARG_POS=$(( $_KAC_CURRENT_COMMAND_NB_WORDS + 1 )) - local COMPLETE_COMMAND=$(cat $_KAC_CACHE_PATH | grep -E "^$_KAC_CURRENT_COMMAND") - local CURRENT_ARG - while [ $CURRENT_ARG_POS -le $COMP_CWORD ] - do - CURRENT_ARG=$(echo $COMPLETE_COMMAND | cut -d ' ' -f $CURRENT_ARG_POS) - # we break if the current arg is a "plural" arg - echo $CURRENT_ARG | grep -E "^\\[[^]]+(\\.\\.\\.\\]|$)" > /dev/null && break - CURRENT_ARG_POS=$(( $CURRENT_ARG_POS + 1 )) - done - echo $CURRENT_ARG_POS +_KAC_get_current_arg_position() { + local CURRENT_ARG_POS=$(($_KAC_CURRENT_COMMAND_NB_WORDS + 1)) + local COMPLETE_COMMAND=$(cat $_KAC_CACHE_PATH | grep -E "^$_KAC_CURRENT_COMMAND") + local CURRENT_ARG + while [ $CURRENT_ARG_POS -le $COMP_CWORD ]; do + CURRENT_ARG=$(echo $COMPLETE_COMMAND | cut -d ' ' -f $CURRENT_ARG_POS) + # we break if the current arg is a "plural" arg + echo $CURRENT_ARG | grep -E "^\\[[^]]+(\\.\\.\\.\\]|$)" > /dev/null && break + CURRENT_ARG_POS=$(($CURRENT_ARG_POS + 1)) + done + echo $CURRENT_ARG_POS } # the actual auto-complete function -_knife() -{ - _KAC_get_and_regen_cache _KAC_knife_commands - local RAW_LIST ITEM REGEN_CMD ARG_POSITION - COMREPLY=() - # get correct command & arg pos - _KAC_get_current_base_command && ARG_POSITION=$(_KAC_get_current_arg_position) || ARG_POSITION=$(( $COMP_CWORD + 1 )) - RAW_LIST=$(cat $_KAC_CACHE_PATH | grep -E "^$_KAC_CURRENT_COMMAND" | cut -d ' ' -f $ARG_POSITION | uniq) +_knife() { + _KAC_get_and_regen_cache _KAC_knife_commands + local RAW_LIST ITEM REGEN_CMD ARG_POSITION + COMREPLY=() + # get correct command & arg pos + _KAC_get_current_base_command && ARG_POSITION=$(_KAC_get_current_arg_position) || ARG_POSITION=$(($COMP_CWORD + 1)) + RAW_LIST=$(cat $_KAC_CACHE_PATH | grep -E "^$_KAC_CURRENT_COMMAND" | cut -d ' ' -f $ARG_POSITION | uniq) - # we need to process that raw list a bit, most notably for placeholders - # NOTE: I chose to explicitely fetch & cache _certain_ informations for the server (cookbooks & node names, etc) - # as opposed to a generic approach by trying to find a 'list' knife command corresponding to the - # current base command - that might limit my script in some situation, but that way I'm sure it caches only - # not-sensitive stuff (a generic approach could be pretty bad e.g. with the knife-rackspace plugin) - LIST="" - for ITEM in $RAW_LIST - do - # always relevant if only lower-case chars : continuation of the base command - echo $ITEM | grep -E "^[a-z]+$" > /dev/null && LIST="$LIST $ITEM" && continue - case $ITEM in - *COOKBOOK*) - # special case for cookbooks : from site or local - [[ ${COMP_WORDS[2]} == 'site' ]] && REGEN_CMD="knife cookbook site list" || REGEN_CMD="knife cookbook list" - _KAC_get_and_regen_cache $REGEN_CMD - LIST="$LIST $(cat $_KAC_CACHE_PATH | cut -d ' ' -f 1)" - continue - ;; - *ITEM*) - # data bag item : another special case - local DATA_BAG_NAME=${COMP_WORDS[$(( COMP_CWORD-1 ))]} - REGEN_CMD="knife data bag show $DATA_BAG_NAME" - ;; - *INDEX*) - # see doc @ http://docs.opscode.com/knife_search.html - LIST="$LIST client environment node role" - REGEN_CMD="knife data bag list" - ;; - *BAG*) REGEN_CMD="knife data bag list";; - *CLIENT*) REGEN_CMD="knife client list";; - *NODE*) REGEN_CMD="knife node list";; - *ENVIRONMENT*) REGEN_CMD="knife environment list";; - *ROLE*) REGEN_CMD="knife role list";; - *USER*) REGEN_CMD="knife user list";; - # not a generic argument we support... - *) continue;; - esac - _KAC_get_and_regen_cache $REGEN_CMD - LIST="$LIST $(cat $_KAC_CACHE_PATH)" - done - COMPREPLY=( $(compgen -W "${LIST}" -- ${COMP_WORDS[COMP_CWORD]})) + # we need to process that raw list a bit, most notably for placeholders + # NOTE: I chose to explicitely fetch & cache _certain_ informations for the server (cookbooks & node names, etc) + # as opposed to a generic approach by trying to find a 'list' knife command corresponding to the + # current base command - that might limit my script in some situation, but that way I'm sure it caches only + # not-sensitive stuff (a generic approach could be pretty bad e.g. with the knife-rackspace plugin) + LIST="" + for ITEM in $RAW_LIST; do + # always relevant if only lower-case chars : continuation of the base command + echo $ITEM | grep -E "^[a-z]+$" > /dev/null && LIST="$LIST $ITEM" && continue + case $ITEM in + *COOKBOOK*) + # special case for cookbooks : from site or local + [[ ${COMP_WORDS[2]} == 'site' ]] && REGEN_CMD="knife cookbook site list" || REGEN_CMD="knife cookbook list" + _KAC_get_and_regen_cache $REGEN_CMD + LIST="$LIST $(cat $_KAC_CACHE_PATH | cut -d ' ' -f 1)" + continue + ;; + *ITEM*) + # data bag item : another special case + local DATA_BAG_NAME=${COMP_WORDS[$((COMP_CWORD - 1))]} + REGEN_CMD="knife data bag show $DATA_BAG_NAME" + ;; + *INDEX*) + # see doc @ http://docs.opscode.com/knife_search.html + LIST="$LIST client environment node role" + REGEN_CMD="knife data bag list" + ;; + *BAG*) REGEN_CMD="knife data bag list" ;; + *CLIENT*) REGEN_CMD="knife client list" ;; + *NODE*) REGEN_CMD="knife node list" ;; + *ENVIRONMENT*) REGEN_CMD="knife environment list" ;; + *ROLE*) REGEN_CMD="knife role list" ;; + *USER*) REGEN_CMD="knife user list" ;; + # not a generic argument we support... + *) continue ;; + esac + _KAC_get_and_regen_cache $REGEN_CMD + LIST="$LIST $(cat $_KAC_CACHE_PATH)" + done + COMPREPLY=($(compgen -W "${LIST}" -- ${COMP_WORDS[COMP_CWORD]})) } #complete -f -F _knife knife From f5fe3dbeb057d4a139e6dca14c571a34ab1fa34b Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Sun, 8 Nov 2020 17:57:54 +0200 Subject: [PATCH 43/68] shell-check fixes --- completion/available/knife.completion.bash | 77 ++++++++++++---------- 1 file changed, 41 insertions(+), 36 deletions(-) diff --git a/completion/available/knife.completion.bash b/completion/available/knife.completion.bash index 191e428c..9b370209 100644 --- a/completion/available/knife.completion.bash +++ b/completion/available/knife.completion.bash @@ -19,7 +19,7 @@ _KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE=86400 ### init _KAC_CACHE_TMP_DIR="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/tmp" # make sure the cache dir exists -mkdir -p $_KAC_CACHE_TMP_DIR +mkdir -p "$_KAC_CACHE_TMP_DIR" ############################## ### Cache helper functions ### @@ -33,7 +33,7 @@ stat -c %Y /dev/null > /dev/null 2>&1 && _KAC_STAT_COMMAND="stat -c %Y" || _KAC_ # returns 1 otherwise _KAC_is_file_newer_than() { [ -f "$1" ] || return 1 - [ $(($(date +%s) - $($_KAC_STAT_COMMAND "$1"))) -gt $2 ] && return 1 || return 0 + [ $(($(date +%s) - $($_KAC_STAT_COMMAND "$1"))) -gt "$2" ] && return 1 || return 0 } # helper function for _KAC_get_and_regen_cache, see doc below @@ -42,10 +42,10 @@ _KAC_regen_cache() { local CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME" local TMP_FILE=$(mktemp "$_KAC_CACHE_TMP_DIR/$CACHE_NAME.XXXX") shift 1 - "$@" > $TMP_FILE 2> /dev/null + "$@" > "$TMP_FILE" 2> /dev/null # discard the temp file if it's empty AND the previous command didn't exit successfully, but still mark the cache as updated - [[ $? != 0 ]] && [[ $(cat $TMP_FILE | wc -l) == 0 ]] && rm -f $TMP_FILE && touch $CACHE_PATH && return 1 \ - || mv -f $TMP_FILE $CACHE_PATH + [[ $? != 0 ]] && [[ $(wc -l "$TMP_FILE") == 0 ]] && rm -f "$TMP_FILE" && touch "$CACHE_PATH" && return 1 \ + || mv -f "$TMP_FILE" "$CACHE_PATH" } # cached files can't have spaces in their names @@ -65,10 +65,14 @@ _KAC_get_command_from_cache_name() { _KAC_get_and_regen_cache() { # the cache name can't have space in it local CACHE_NAME=$(_KAC_get_cache_name_from_command "$@") - local REGEN_CMD="_KAC_regen_cache $CACHE_NAME $@" + local REGEN_CMD="_KAC_regen_cache $CACHE_NAME $*" _KAC_CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME" # no need to wait for the regen if the file already exists - [ -f $_KAC_CACHE_PATH ] && ($REGEN_CMD &) || $REGEN_CMD + if [[ -f "$_KAC_CACHE_PATH" ]]; then + ($REGEN_CMD &) + else + $REGEN_CMD + fi } # performs two things: first, deletes all obsolete temp files @@ -76,17 +80,18 @@ _KAC_get_and_regen_cache() { _KAC_clean_cache() { local FILE CMD # delete all obsolete temp files, could be lingering there for any kind of crash in the caching process - for FILE in $(ls $_KAC_CACHE_TMP_DIR); do - _KAC_is_file_newer_than $FILE $_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE || rm -f $FILE + for FILE in $(\ls "$_KAC_CACHE_TMP_DIR"); do + _KAC_is_file_newer_than "$FILE" "$_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE" || rm -f "$FILE" done # refresh really stale caches - for FILE in $(find $_KNIFE_AUTOCOMPLETE_CACHE_DIR -maxdepth 1 -type f -not -name '.*'); do - _KAC_is_file_newer_than $FILE $_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE && continue - # first let's get the original command - CMD=$(_KAC_get_command_from_cache_name $(basename "$FILE")) - # then regen the cache - _KAC_get_and_regen_cache "$CMD" > /dev/null - done + find "$_KNIFE_AUTOCOMPLETE_CACHE_DIR" -maxdepth 1 -type f -not -name '.*' \ + | while read -r FILE; do + _KAC_is_file_newer_than "$FILE" "$_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE" && continue + # first let's get the original command + CMD=$(_KAC_get_command_from_cache_name "$(basename "$FILE")") + # then regen the cache + _KAC_get_and_regen_cache "$CMD" > /dev/null + done } # perform a cache cleaning when loading this file @@ -109,32 +114,32 @@ _KAC_get_current_base_command() { local PREVIOUS="knife" local I=1 local CURRENT - while [ $I -le $COMP_CWORD ]; do + while [ $I -le "$COMP_CWORD" ]; do # command words are all lower-case - echo ${COMP_WORDS[$I]} | grep -E "^[a-z]+$" > /dev/null || break + echo "${COMP_WORDS[$I]}" | grep -E "^[a-z]+$" > /dev/null || break CURRENT="$PREVIOUS ${COMP_WORDS[$I]}" - cat $_KAC_CACHE_PATH | grep -E "^$CURRENT" > /dev/null || break + grep -E "^$CURRENT" "$_KAC_CACHE_PATH" > /dev/null || break PREVIOUS=$CURRENT - I=$(($I + 1)) + I=$((I + 1)) done _KAC_CURRENT_COMMAND=$PREVIOUS - [ $I -le $COMP_CWORD ] && _KAC_CURRENT_COMMAND_NB_WORDS=$I + [ $I -le "$COMP_CWORD" ] && _KAC_CURRENT_COMMAND_NB_WORDS=$I } # searches the position of the currently completed argument in the current base command # (i.e. handles "plural" arguments such as knife cookbook upload cookbook1 cookbook2 and so on...) # assumes the current base command is complete _KAC_get_current_arg_position() { - local CURRENT_ARG_POS=$(($_KAC_CURRENT_COMMAND_NB_WORDS + 1)) - local COMPLETE_COMMAND=$(cat $_KAC_CACHE_PATH | grep -E "^$_KAC_CURRENT_COMMAND") + local CURRENT_ARG_POS=$((_KAC_CURRENT_COMMAND_NB_WORDS + 1)) + local COMPLETE_COMMAND=$(grep -E "^$_KAC_CURRENT_COMMAND" "$_KAC_CACHE_PATH") local CURRENT_ARG - while [ $CURRENT_ARG_POS -le $COMP_CWORD ]; do - CURRENT_ARG=$(echo $COMPLETE_COMMAND | cut -d ' ' -f $CURRENT_ARG_POS) + while [ "$CURRENT_ARG_POS" -le "$COMP_CWORD" ]; do + CURRENT_ARG=$(echo "$COMPLETE_COMMAND" | cut -d ' ' -f "$CURRENT_ARG_POS") # we break if the current arg is a "plural" arg - echo $CURRENT_ARG | grep -E "^\\[[^]]+(\\.\\.\\.\\]|$)" > /dev/null && break - CURRENT_ARG_POS=$(($CURRENT_ARG_POS + 1)) + echo "$CURRENT_ARG" | grep -E "^\\[[^]]+(\\.\\.\\.\\]|$)" > /dev/null && break + CURRENT_ARG_POS=$((CURRENT_ARG_POS + 1)) done - echo $CURRENT_ARG_POS + echo "$CURRENT_ARG_POS" } # the actual auto-complete function @@ -143,8 +148,8 @@ _knife() { local RAW_LIST ITEM REGEN_CMD ARG_POSITION COMREPLY=() # get correct command & arg pos - _KAC_get_current_base_command && ARG_POSITION=$(_KAC_get_current_arg_position) || ARG_POSITION=$(($COMP_CWORD + 1)) - RAW_LIST=$(cat $_KAC_CACHE_PATH | grep -E "^$_KAC_CURRENT_COMMAND" | cut -d ' ' -f $ARG_POSITION | uniq) + _KAC_get_current_base_command && ARG_POSITION=$(_KAC_get_current_arg_position) || ARG_POSITION=$((COMP_CWORD + 1)) + RAW_LIST=$(grep -E "^$_KAC_CURRENT_COMMAND" "$_KAC_CACHE_PATH" | cut -d ' ' -f $ARG_POSITION | uniq) # we need to process that raw list a bit, most notably for placeholders # NOTE: I chose to explicitely fetch & cache _certain_ informations for the server (cookbooks & node names, etc) @@ -154,13 +159,13 @@ _knife() { LIST="" for ITEM in $RAW_LIST; do # always relevant if only lower-case chars : continuation of the base command - echo $ITEM | grep -E "^[a-z]+$" > /dev/null && LIST="$LIST $ITEM" && continue - case $ITEM in + echo "$ITEM" | grep -E "^[a-z]+$" > /dev/null && LIST="$LIST $ITEM" && continue + case "$ITEM" in *COOKBOOK*) # special case for cookbooks : from site or local [[ ${COMP_WORDS[2]} == 'site' ]] && REGEN_CMD="knife cookbook site list" || REGEN_CMD="knife cookbook list" - _KAC_get_and_regen_cache $REGEN_CMD - LIST="$LIST $(cat $_KAC_CACHE_PATH | cut -d ' ' -f 1)" + _KAC_get_and_regen_cache "$REGEN_CMD" + LIST="$LIST $(cut -d ' ' -f 1 < "$_KAC_CACHE_PATH")" continue ;; *ITEM*) @@ -182,8 +187,8 @@ _knife() { # not a generic argument we support... *) continue ;; esac - _KAC_get_and_regen_cache $REGEN_CMD - LIST="$LIST $(cat $_KAC_CACHE_PATH)" + _KAC_get_and_regen_cache "$REGEN_CMD" + LIST="$LIST $(cat "$_KAC_CACHE_PATH")" done COMPREPLY=($(compgen -W "${LIST}" -- ${COMP_WORDS[COMP_CWORD]})) } From d84d6a8356f165e52744923ae06e597ec847ddc2 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Sun, 8 Nov 2020 18:48:29 +0200 Subject: [PATCH 44/68] Add a credit comment --- completion/available/knife.completion.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/completion/available/knife.completion.bash b/completion/available/knife.completion.bash index 9b370209..8c6fef9b 100644 --- a/completion/available/knife.completion.bash +++ b/completion/available/knife.completion.bash @@ -1,5 +1,7 @@ #!/usr/bin/env bash +# Published originally as public domain code at https://github.com/wk8/knife-bash-autocomplete + ############## ### CONFIG ### ############## From 06b1ffecc0d3abe84a784103c5f9c8f7ae7b1ae9 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Thu, 19 Nov 2020 01:10:02 +0200 Subject: [PATCH 45/68] Add rustup completion --- completion/available/rustup.completion.bash | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 completion/available/rustup.completion.bash diff --git a/completion/available/rustup.completion.bash b/completion/available/rustup.completion.bash new file mode 100644 index 00000000..96822031 --- /dev/null +++ b/completion/available/rustup.completion.bash @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# rustup (Rust toolchain installer) completion + +if _binary_exists rustup; then + eval "$(rustup completions bash)" +fi From b70da511f2685a055caf38fbc72a48766315bf57 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Fri, 20 Nov 2020 13:01:41 +0200 Subject: [PATCH 46/68] Add rustup completion to clean_files.txt --- clean_files.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clean_files.txt b/clean_files.txt index 0276d20b..52981cf4 100644 --- a/clean_files.txt +++ b/clean_files.txt @@ -27,3 +27,7 @@ lint_clean_files.sh # themes/90210 themes/powerline + +# completions +# +completion/available/rustup.completion.bash From 794f0e321e53f4658e9532ea7e2c801fbda5761c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Felipe=20S=C3=A1nchez?= Date: Thu, 26 Nov 2020 09:11:08 -0500 Subject: [PATCH 47/68] Update atomic.theme.bash fixed the space error after hiding the scm --- themes/atomic/atomic.theme.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/atomic/atomic.theme.bash b/themes/atomic/atomic.theme.bash index 5035d49f..129bcbb6 100644 --- a/themes/atomic/atomic.theme.bash +++ b/themes/atomic/atomic.theme.bash @@ -117,7 +117,7 @@ ___atomic_prompt_user_info() { ___atomic_prompt_dir() { color=${IRed} - box="[|]${normal}${Line}" + box="[|]${normal}" info="\w" printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white}" "${box}" } @@ -125,7 +125,7 @@ ___atomic_prompt_dir() { ___atomic_prompt_scm() { [ "${THEME_SHOW_SCM}" != "true" ] && return color=$bold_green - box="[${IWhite}$(scm_char)] " + box="${Line}[${IWhite}$(scm_char)] " info="$(scm_prompt_info)" printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white}" "${box}" } From 8ce9d8daa56de7998b853c1151c4faa291119145 Mon Sep 17 00:00:00 2001 From: Kan Li Date: Sat, 28 Nov 2020 12:05:36 -0800 Subject: [PATCH 48/68] Add in_toolbox prompt to powerline themes [Toolbox](https://github.com/containers/toolbox) is an containerized development environment. This commit adds a promot to powerline when it is running inside a toolbox. --- themes/gitline/gitline.theme.bash | 3 +++ themes/gitline/powerline.base.bash | 18 +++++++++++++----- themes/powerline-multiline/README.md | 1 + .../powerline-multiline.theme.bash | 3 +++ themes/powerline-naked/README.md | 1 + .../powerline-naked/powerline-naked.theme.bash | 3 +++ themes/powerline-plain/README.md | 1 + .../powerline-plain/powerline-plain.theme.bash | 3 +++ themes/powerline/README.md | 1 + themes/powerline/powerline.base.bash | 6 ++++++ themes/powerline/powerline.theme.bash | 3 +++ themes/redline/redline.theme.bash | 3 +++ 12 files changed, 41 insertions(+), 5 deletions(-) diff --git a/themes/gitline/gitline.theme.bash b/themes/gitline/gitline.theme.bash index 995b8c07..ef0bdae0 100644 --- a/themes/gitline/gitline.theme.bash +++ b/themes/gitline/gitline.theme.bash @@ -64,5 +64,8 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"} IN_VIM_THEME_PROMPT_COLOR=245 IN_VIM_THEME_PROMPT_TEXT="vim" +IN_TOOLBOX_THEME_PROMPT_COLOR=125 +IN_TOOLBOX_THEME_PROMPT_TEXT=" " + safe_append_prompt_command __powerline_prompt_command diff --git a/themes/gitline/powerline.base.bash b/themes/gitline/powerline.base.bash index 0f8a3028..93be7d2f 100644 --- a/themes/gitline/powerline.base.bash +++ b/themes/gitline/powerline.base.bash @@ -120,13 +120,13 @@ function __powerline_cwd_prompt { } function __powerline_hostname_prompt { - local fg_color=206 + local fg_color=206 - echo "$(hostname -s)|${HOST_THEME_PROMPT_COLOR}|${fg_color}" + echo "$(hostname -s)|${HOST_THEME_PROMPT_COLOR}|${fg_color}" } function __powerline_wd_prompt { - local fg_color=206 + local fg_color=206 echo "\W|${CWD_THEME_PROMPT_COLOR}|${fg_color}" } @@ -158,7 +158,7 @@ function __powerline_battery_prompt { } function __powerline_in_vim_prompt { - local fg_color=206 + local fg_color=206 if [ -n "$VIMRUNTIME" ]; then echo "${IN_VIM_THEME_PROMPT_TEXT}|${IN_VIM_THEME_PROMPT_COLOR}|${fg_color}" @@ -166,13 +166,21 @@ function __powerline_in_vim_prompt { } function __powerline_aws_profile_prompt { - local fg_color=206 + local fg_color=206 if [[ -n "${AWS_PROFILE}" ]]; then echo "${AWS_PROFILE_CHAR}${AWS_PROFILE}|${AWS_PROFILE_PROMPT_COLOR}|${fg_color}" fi } +function __powerline_in_toolbox_prompt { + local fg_color=206 + + if [[ -e /run/.toolboxenv ]]; then + echo "${IN_TOOLBOX_THEME_PROMPT_TEXT}|${IN_TOOLBOX_THEME_PROMPT_COLOR}|${fg_color}" + fi +} + function __powerline_left_segment { local OLD_IFS="${IFS}"; IFS="|" local params=( $1 ) diff --git a/themes/powerline-multiline/README.md b/themes/powerline-multiline/README.md index da66d4ef..2654ff1c 100644 --- a/themes/powerline-multiline/README.md +++ b/themes/powerline-multiline/README.md @@ -59,6 +59,7 @@ The contents of both prompt sides can be "reordered", all the "segments" (every * `clock` - Current time in `HH:MM:SS` format * `cwd` - Current working directory including full folder hierarchy (c.f. `wd`) * `hostname` - Host name of machine +* `in_toolbox` - Show identifier if running inside a toolbox * `in_vim` - Show identifier if running in `:terminal` from vim * `k8s_context` - Show current kubernetes context * `last_status` - Exit status of last run command diff --git a/themes/powerline-multiline/powerline-multiline.theme.bash b/themes/powerline-multiline/powerline-multiline.theme.bash index 54651cb6..da874718 100644 --- a/themes/powerline-multiline/powerline-multiline.theme.bash +++ b/themes/powerline-multiline/powerline-multiline.theme.bash @@ -74,6 +74,9 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"} IN_VIM_THEME_PROMPT_COLOR=${POWERLINE_IN_VIM_COLOR:=245} IN_VIM_THEME_PROMPT_TEXT=${POWERLINE_IN_VIM_TEXT:="vim"} +IN_TOOLBOX_THEME_PROMPT_COLOR=${POWERLINE_IN_TOOLBOX_COLOR:=125} +IN_TOOLBOX_THEME_PROMPT_TEXT=${POWERLINE_IN_TOOLBOX_TEXT:="❲T❳ "} + HOST_THEME_PROMPT_COLOR=${POWERLINE_HOST_COLOR:=0} SHLVL_THEME_PROMPT_COLOR=${POWERLINE_SHLVL_COLOR:=${HOST_THEME_PROMPT_COLOR}} diff --git a/themes/powerline-naked/README.md b/themes/powerline-naked/README.md index ec3b8fac..debdc1bd 100644 --- a/themes/powerline-naked/README.md +++ b/themes/powerline-naked/README.md @@ -52,6 +52,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o * `clock` - Current time in `HH:MM:SS` format * `cwd` - Current working directory including full folder hierarchy (c.f. `wd`) * `hostname` - Host name of machine +* `in_toolbox` - Show identifier if running inside a toolbox * `in_vim` - Show identifier if running in `:terminal` from vim * `k8s_context` - Show current kubernetes context * `last_status` - Exit status of last run command diff --git a/themes/powerline-naked/powerline-naked.theme.bash b/themes/powerline-naked/powerline-naked.theme.bash index 5c5fed26..89713d4a 100644 --- a/themes/powerline-naked/powerline-naked.theme.bash +++ b/themes/powerline-naked/powerline-naked.theme.bash @@ -69,6 +69,9 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"} IN_VIM_THEME_PROMPT_COLOR=${POWERLINE_IN_VIM_COLOR:=245} IN_VIM_THEME_PROMPT_TEXT=${POWERLINE_IN_VIM_TEXT:="vim"} +IN_TOOLBOX_THEME_PROMPT_COLOR=${POWERLINE_IN_TOOLBOX_COLOR:=125} +IN_TOOLBOX_THEME_PROMPT_TEXT=${POWERLINE_IN_TOOLBOX_TEXT:="❲T❳ "} + HOST_THEME_PROMPT_COLOR=${POWERLINE_HOST_COLOR:=254} SHLVL_THEME_PROMPT_COLOR=${POWERLINE_SHLVL_COLOR:=${HOST_THEME_PROMPT_COLOR}} diff --git a/themes/powerline-plain/README.md b/themes/powerline-plain/README.md index 0a8a75ad..019078c4 100644 --- a/themes/powerline-plain/README.md +++ b/themes/powerline-plain/README.md @@ -50,6 +50,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o * `clock` - Current time in `HH:MM:SS` format * `cwd` - Current working directory including full folder hierarchy (c.f. `wd`) * `hostname` - Host name of machine +* `in_toolbox` - Show identifier if running inside a toolbox * `in_vim` - Show identifier if running in `:terminal` from vim * `k8s_context` - Show current kubernetes context * `last_status` - Exit status of last run command diff --git a/themes/powerline-plain/powerline-plain.theme.bash b/themes/powerline-plain/powerline-plain.theme.bash index 6ae81a56..c65d5760 100644 --- a/themes/powerline-plain/powerline-plain.theme.bash +++ b/themes/powerline-plain/powerline-plain.theme.bash @@ -66,6 +66,9 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"} IN_VIM_THEME_PROMPT_COLOR=${POWERLINE_IN_VIM_COLOR:=245} IN_VIM_THEME_PROMPT_TEXT=${POWERLINE_IN_VIM_TEXT:="vim"} +IN_TOOLBOX_THEME_PROMPT_COLOR=${POWERLINE_IN_TOOLBOX_COLOR:=125} +IN_TOOLBOX_THEME_PROMPT_TEXT=${POWERLINE_IN_TOOLBOX_TEXT:="Ⓣ "} + HOST_THEME_PROMPT_COLOR=${POWERLINE_HOST_COLOR:=0} SHLVL_THEME_PROMPT_COLOR=${POWERLINE_SHLVL_COLOR:=${HOST_THEME_PROMPT_COLOR}} diff --git a/themes/powerline/README.md b/themes/powerline/README.md index 587e0788..251a1b50 100644 --- a/themes/powerline/README.md +++ b/themes/powerline/README.md @@ -58,6 +58,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o * `clock` - Current time in `HH:MM:SS` format * `cwd` - Current working directory including full folder hierarchy (c.f. `wd`) * `hostname` - Host name of machine +* `in_toolbox` - Show identifier if running inside a toolbox * `in_vim` - Show identifier if running in `:terminal` from vim * `k8s_context` - Show current kubernetes context * `last_status` - Exit status of last run command diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index b2596793..aca9f1e3 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -169,6 +169,12 @@ function __powerline_aws_profile_prompt() { fi } +function __powerline_in_toolbox_prompt() { + if [[ -e /run/.toolboxenv ]]; then + echo "${IN_TOOLBOX_THEME_PROMPT_TEXT}|${IN_TOOLBOX_THEME_PROMPT_COLOR}" + fi +} + function __powerline_shlvl_prompt() { if [[ "${SHLVL}" -gt 1 ]]; then local prompt="${SHLVL_THEME_PROMPT_CHAR}" diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index 1463d777..09fb6747 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -71,6 +71,9 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"} IN_VIM_THEME_PROMPT_COLOR=${POWERLINE_IN_VIM_COLOR:=245} IN_VIM_THEME_PROMPT_TEXT=${POWERLINE_IN_VIM_TEXT:="vim"} +IN_TOOLBOX_THEME_PROMPT_COLOR=${POWERLINE_IN_TOOLBOX_COLOR:=125} +IN_TOOLBOX_THEME_PROMPT_TEXT=${POWERLINE_IN_TOOLBOX_TEXT:="❲T❳ "} + HOST_THEME_PROMPT_COLOR=${POWERLINE_HOST_COLOR:=0} SHLVL_THEME_PROMPT_COLOR=${POWERLINE_SHLVL_COLOR:=${HOST_THEME_PROMPT_COLOR}} diff --git a/themes/redline/redline.theme.bash b/themes/redline/redline.theme.bash index 3d67e8a5..e1f2a283 100644 --- a/themes/redline/redline.theme.bash +++ b/themes/redline/redline.theme.bash @@ -55,6 +55,9 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"} IN_VIM_THEME_PROMPT_COLOR=245 IN_VIM_THEME_PROMPT_TEXT="vim" +IN_TOOLBOX_THEME_PROMPT_COLOR=125 +IN_TOOLBOX_THEME_PROMPT_TEXT=" " + POWERLINE_PROMPT=${POWERLINE_PROMPT:="python_venv ruby user_info hostname cwd scm"} safe_append_prompt_command __powerline_prompt_command From c13850faa2a3eef8ac9f10bf62ad3c41e0f37f48 Mon Sep 17 00:00:00 2001 From: Kan Li Date: Sat, 28 Nov 2020 18:49:25 -0800 Subject: [PATCH 49/68] Address some comments. --- themes/gitline/gitline.theme.bash | 2 +- themes/gitline/powerline.base.bash | 2 +- themes/powerline-multiline/README.md | 2 +- themes/powerline-multiline/powerline-multiline.theme.bash | 2 +- themes/powerline-naked/README.md | 2 +- themes/powerline-naked/powerline-naked.theme.bash | 2 +- themes/powerline-plain/README.md | 2 +- themes/powerline-plain/powerline-plain.theme.bash | 2 +- themes/powerline/README.md | 2 +- themes/powerline/powerline.base.bash | 2 +- themes/powerline/powerline.theme.bash | 2 +- themes/redline/redline.theme.bash | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/themes/gitline/gitline.theme.bash b/themes/gitline/gitline.theme.bash index ef0bdae0..9a68f370 100644 --- a/themes/gitline/gitline.theme.bash +++ b/themes/gitline/gitline.theme.bash @@ -65,7 +65,7 @@ IN_VIM_THEME_PROMPT_COLOR=245 IN_VIM_THEME_PROMPT_TEXT="vim" IN_TOOLBOX_THEME_PROMPT_COLOR=125 -IN_TOOLBOX_THEME_PROMPT_TEXT=" " +IN_TOOLBOX_THEME_PROMPT_TEXT="⬢ " safe_append_prompt_command __powerline_prompt_command diff --git a/themes/gitline/powerline.base.bash b/themes/gitline/powerline.base.bash index 93be7d2f..4f6b17b0 100644 --- a/themes/gitline/powerline.base.bash +++ b/themes/gitline/powerline.base.bash @@ -176,7 +176,7 @@ function __powerline_aws_profile_prompt { function __powerline_in_toolbox_prompt { local fg_color=206 - if [[ -e /run/.toolboxenv ]]; then + if [ -f /run/.containerenv ] && [ -f /run/.toolboxenv ]; then echo "${IN_TOOLBOX_THEME_PROMPT_TEXT}|${IN_TOOLBOX_THEME_PROMPT_COLOR}|${fg_color}" fi } diff --git a/themes/powerline-multiline/README.md b/themes/powerline-multiline/README.md index 2654ff1c..8f29f008 100644 --- a/themes/powerline-multiline/README.md +++ b/themes/powerline-multiline/README.md @@ -59,7 +59,7 @@ The contents of both prompt sides can be "reordered", all the "segments" (every * `clock` - Current time in `HH:MM:SS` format * `cwd` - Current working directory including full folder hierarchy (c.f. `wd`) * `hostname` - Host name of machine -* `in_toolbox` - Show identifier if running inside a toolbox +* `in_toolbox` - Show identifier if running inside a [toolbox](https://github.com/containers/toolbox) * `in_vim` - Show identifier if running in `:terminal` from vim * `k8s_context` - Show current kubernetes context * `last_status` - Exit status of last run command diff --git a/themes/powerline-multiline/powerline-multiline.theme.bash b/themes/powerline-multiline/powerline-multiline.theme.bash index da874718..a86eac3c 100644 --- a/themes/powerline-multiline/powerline-multiline.theme.bash +++ b/themes/powerline-multiline/powerline-multiline.theme.bash @@ -75,7 +75,7 @@ IN_VIM_THEME_PROMPT_COLOR=${POWERLINE_IN_VIM_COLOR:=245} IN_VIM_THEME_PROMPT_TEXT=${POWERLINE_IN_VIM_TEXT:="vim"} IN_TOOLBOX_THEME_PROMPT_COLOR=${POWERLINE_IN_TOOLBOX_COLOR:=125} -IN_TOOLBOX_THEME_PROMPT_TEXT=${POWERLINE_IN_TOOLBOX_TEXT:="❲T❳ "} +IN_TOOLBOX_THEME_PROMPT_TEXT=${POWERLINE_IN_TOOLBOX_TEXT:="⬢ "} HOST_THEME_PROMPT_COLOR=${POWERLINE_HOST_COLOR:=0} diff --git a/themes/powerline-naked/README.md b/themes/powerline-naked/README.md index debdc1bd..bb709869 100644 --- a/themes/powerline-naked/README.md +++ b/themes/powerline-naked/README.md @@ -52,7 +52,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o * `clock` - Current time in `HH:MM:SS` format * `cwd` - Current working directory including full folder hierarchy (c.f. `wd`) * `hostname` - Host name of machine -* `in_toolbox` - Show identifier if running inside a toolbox +* `in_toolbox` - Show identifier if running inside a [toolbox](https://github.com/containers/toolbox) * `in_vim` - Show identifier if running in `:terminal` from vim * `k8s_context` - Show current kubernetes context * `last_status` - Exit status of last run command diff --git a/themes/powerline-naked/powerline-naked.theme.bash b/themes/powerline-naked/powerline-naked.theme.bash index 89713d4a..7a5bd4ed 100644 --- a/themes/powerline-naked/powerline-naked.theme.bash +++ b/themes/powerline-naked/powerline-naked.theme.bash @@ -70,7 +70,7 @@ IN_VIM_THEME_PROMPT_COLOR=${POWERLINE_IN_VIM_COLOR:=245} IN_VIM_THEME_PROMPT_TEXT=${POWERLINE_IN_VIM_TEXT:="vim"} IN_TOOLBOX_THEME_PROMPT_COLOR=${POWERLINE_IN_TOOLBOX_COLOR:=125} -IN_TOOLBOX_THEME_PROMPT_TEXT=${POWERLINE_IN_TOOLBOX_TEXT:="❲T❳ "} +IN_TOOLBOX_THEME_PROMPT_TEXT=${POWERLINE_IN_TOOLBOX_TEXT:="⬢ "} HOST_THEME_PROMPT_COLOR=${POWERLINE_HOST_COLOR:=254} diff --git a/themes/powerline-plain/README.md b/themes/powerline-plain/README.md index 019078c4..bdd9fdd8 100644 --- a/themes/powerline-plain/README.md +++ b/themes/powerline-plain/README.md @@ -50,7 +50,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o * `clock` - Current time in `HH:MM:SS` format * `cwd` - Current working directory including full folder hierarchy (c.f. `wd`) * `hostname` - Host name of machine -* `in_toolbox` - Show identifier if running inside a toolbox +* `in_toolbox` - Show identifier if running inside a [toolbox](https://github.com/containers/toolbox) * `in_vim` - Show identifier if running in `:terminal` from vim * `k8s_context` - Show current kubernetes context * `last_status` - Exit status of last run command diff --git a/themes/powerline-plain/powerline-plain.theme.bash b/themes/powerline-plain/powerline-plain.theme.bash index c65d5760..b2a290a5 100644 --- a/themes/powerline-plain/powerline-plain.theme.bash +++ b/themes/powerline-plain/powerline-plain.theme.bash @@ -67,7 +67,7 @@ IN_VIM_THEME_PROMPT_COLOR=${POWERLINE_IN_VIM_COLOR:=245} IN_VIM_THEME_PROMPT_TEXT=${POWERLINE_IN_VIM_TEXT:="vim"} IN_TOOLBOX_THEME_PROMPT_COLOR=${POWERLINE_IN_TOOLBOX_COLOR:=125} -IN_TOOLBOX_THEME_PROMPT_TEXT=${POWERLINE_IN_TOOLBOX_TEXT:="Ⓣ "} +IN_TOOLBOX_THEME_PROMPT_TEXT=${POWERLINE_IN_TOOLBOX_TEXT:="⬢ "} HOST_THEME_PROMPT_COLOR=${POWERLINE_HOST_COLOR:=0} diff --git a/themes/powerline/README.md b/themes/powerline/README.md index 251a1b50..edb87de9 100644 --- a/themes/powerline/README.md +++ b/themes/powerline/README.md @@ -58,7 +58,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o * `clock` - Current time in `HH:MM:SS` format * `cwd` - Current working directory including full folder hierarchy (c.f. `wd`) * `hostname` - Host name of machine -* `in_toolbox` - Show identifier if running inside a toolbox +* `in_toolbox` - Show identifier if running inside a [toolbox](https://github.com/containers/toolbox) * `in_vim` - Show identifier if running in `:terminal` from vim * `k8s_context` - Show current kubernetes context * `last_status` - Exit status of last run command diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index aca9f1e3..38c5c895 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -170,7 +170,7 @@ function __powerline_aws_profile_prompt() { } function __powerline_in_toolbox_prompt() { - if [[ -e /run/.toolboxenv ]]; then + if [ -f /run/.containerenv ] && [ -f /run/.toolboxenv ]; then echo "${IN_TOOLBOX_THEME_PROMPT_TEXT}|${IN_TOOLBOX_THEME_PROMPT_COLOR}" fi } diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index 09fb6747..83731614 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -72,7 +72,7 @@ IN_VIM_THEME_PROMPT_COLOR=${POWERLINE_IN_VIM_COLOR:=245} IN_VIM_THEME_PROMPT_TEXT=${POWERLINE_IN_VIM_TEXT:="vim"} IN_TOOLBOX_THEME_PROMPT_COLOR=${POWERLINE_IN_TOOLBOX_COLOR:=125} -IN_TOOLBOX_THEME_PROMPT_TEXT=${POWERLINE_IN_TOOLBOX_TEXT:="❲T❳ "} +IN_TOOLBOX_THEME_PROMPT_TEXT=${POWERLINE_IN_TOOLBOX_TEXT:="⬢ "} HOST_THEME_PROMPT_COLOR=${POWERLINE_HOST_COLOR:=0} diff --git a/themes/redline/redline.theme.bash b/themes/redline/redline.theme.bash index e1f2a283..e8810106 100644 --- a/themes/redline/redline.theme.bash +++ b/themes/redline/redline.theme.bash @@ -56,7 +56,7 @@ IN_VIM_THEME_PROMPT_COLOR=245 IN_VIM_THEME_PROMPT_TEXT="vim" IN_TOOLBOX_THEME_PROMPT_COLOR=125 -IN_TOOLBOX_THEME_PROMPT_TEXT=" " +IN_TOOLBOX_THEME_PROMPT_TEXT="⬢ " POWERLINE_PROMPT=${POWERLINE_PROMPT:="python_venv ruby user_info hostname cwd scm"} From 1702e0217ad921b75d945634d1e284aa4eb52fa4 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sat, 31 Oct 2020 23:00:57 +0200 Subject: [PATCH 50/68] docs: Remove themes readmes --- themes/atomic/README.md | 166 ------------------------ themes/barbuk/README.md | 106 --------------- themes/bira/README.md | 8 -- themes/brainy/README.md | 123 ------------------ themes/codeword/README.md | 22 ---- themes/nwinkler_random_colors/README.md | 28 ---- themes/powerline-multiline/README.md | 121 ----------------- themes/powerline-naked/README.md | 92 ------------- themes/powerline-plain/README.md | 91 ------------- themes/powerline/README.md | 98 -------------- themes/radek/README.md | 19 --- themes/redline/README.md | 43 ------ 12 files changed, 917 deletions(-) delete mode 100644 themes/atomic/README.md delete mode 100644 themes/barbuk/README.md delete mode 100644 themes/bira/README.md delete mode 100644 themes/brainy/README.md delete mode 100644 themes/codeword/README.md delete mode 100644 themes/nwinkler_random_colors/README.md delete mode 100644 themes/powerline-multiline/README.md delete mode 100644 themes/powerline-naked/README.md delete mode 100644 themes/powerline-plain/README.md delete mode 100644 themes/powerline/README.md delete mode 100644 themes/radek/README.md delete mode 100644 themes/redline/README.md diff --git a/themes/atomic/README.md b/themes/atomic/README.md deleted file mode 100644 index 60e20828..00000000 --- a/themes/atomic/README.md +++ /dev/null @@ -1,166 +0,0 @@ -# Atomic theme - -The Best ColorFull terminal prompt theme inspired by a number of themes and based on the theme of @MunifTanjim [`brainy`](../brainy/README.md). - -Supported on all operating systems. - -In constant maintenance and improvement - -![Atomic-Theme](https://raw.githubusercontent.com/lfelipe1501/lfelipe-projects/master/AtomicTheme.gif) - -## Install Theme - -### Manually - -You can install the theme manually by following these steps: -Edit your modified config `~/.bashrc` file in order to customize Bash-it, set `BASH_IT_THEME` to the theme name `atomic`. - -Examples: - -```bash -# Use the "atomic" theme -export BASH_IT_THEME="atomic" -``` - -### Automatically via terminal - -1. You can install the theme automatically using the `sed` command from your Linux or OSX Terminal. -2. On macOS, the ~/.bash_profile is used, not the ~/.bashrc. -3. For installation on windows you should use [`Git-Bash`](https://git-for-windows.github.io/) or make sure the terminal emulator you use (ej: cygwin, mintty, etc) has the `sed` command installed. - -Command to execute For Windows and Linux: -```bash -# Set the "atomic" theme replacing the theme you are using of bash-it -sed -i 's/'"$BASH_IT_THEME"'/atomic/g' ~/.bashrc -``` -Command to execute for macOS: -```bash -# Set the "atomic" theme replacing the theme you are using of bash-it -sed -i '' 's/'"$BASH_IT_THEME"'/atomic/g' ~/.bash_profile -``` - -## Features - -### Prompt Segments - -- Username & Hostname -- Current Directory -- SCM Information -- Battery Charge -- Clock -- [Todo.txt](https://github.com/ginatrapani/todo.txt-cli) status -- Ruby Environment -- Python Environment -- Exit Code - -### Others - -- Indicator for cached `sudo` credential -- Indicator for abort (ctrl + C) the current task and regain user control -- `atomic` command for showing/hiding various prompt segments on-the-fly - -## Configuration - -Various prompt segments can be shown/hidden or modified according to your choice. There are two ways for doing that: - -1. On-the-fly using `atomic` command -2. Theme Environment Variables - -### On-the-fly using `atomic` command - -This theme provides a command for showing/hiding prompt segments. - -`atomic show ` - -`atomic hide ` - -Tab-completion for this command is enabled by default. - -Configuration specified by this command will only be applied to current and subsequent child shells. - -### Theme Environment Variables - -This is used for permanent settings that apply to all terminal sessions. You have to define the value of specific theme variables in your `bashrc` (or equivalent) file. - -The name of the variables are listed below along with their default values. - -#### User Information - -Indicator for cached `sudo` credential (see `sudo` manpage for more information): - -`THEME_SHOW_SUDO=true` - -#### SCM Information - -Information about SCM repository status: - -`THEME_SHOW_SCM=true` - -#### Ruby Environment - -Ruby environment version information: - -`THEME_SHOW_RUBY=false` - -#### Python Environment - -Python environment version information: - -`THEME_SHOW_PYTHON=false` - -#### ToDo.txt status - -[Todo.txt](https://github.com/ginatrapani/todo.txt-cli) status: - -`THEME_SHOW_TODO=false` - -#### Clock - -`THEME_SHOW_CLOCK=true` - -`THEME_CLOCK_COLOR=$bold_cyan` - -Format of the clock (see `date` manpage for more information): - -`THEME_CLOCK_FORMAT="%H:%M:%S"` - -#### Battery Charge - -Battery charge percentage: - -`THEME_SHOW_BATTERY=false` - -#### Exit Code - -Exit code of the last command: - -`THEME_SHOW_EXITCODE=true` - -## Prompt Segments Order - -Currently available prompt segments are: - -- battery -- char -- clock -- dir -- exitcode -- python -- ruby -- scm -- todo -- user_info - -Three environment variables can be defined to rearrange the segments order. The default values are: - -`___ATOMIC_TOP_LEFT="user_info dir scm"` - -`___ATOMIC_TOP_RIGHT="exitcode python ruby todo clock battery"` - -`___ATOMIC_BOTTOM="char"` - -### Development by - -Developer / Author: [Luis Felipe Sánchez](https://github.com/lfelipe1501) - -This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. diff --git a/themes/barbuk/README.md b/themes/barbuk/README.md deleted file mode 100644 index cfff155f..00000000 --- a/themes/barbuk/README.md +++ /dev/null @@ -1,106 +0,0 @@ -# BarbUk theme - -A minimal theme with a clean git prompt - -## Provided Information - -* Current git remote tool logo (support: github, gitlab, bitbucket) -* Current path (red when user is root) -* Current git info -* Last command exit code (only shown when the exit code is greater than 0) -* user@hostname for ssh connection - -## Fonts and glyphs - -A font with SCM glyphs is required to display the default tool/host logos. -You can use a font from https://www.nerdfonts.com/ or patch your own font with the tool -provided by https://github.com/ryanoasis/nerd-fonts. - -You can also override the default variables if you want to use different glyphs or standard ASCII characters. - -### Default theme glyphs - -```bash -BARBUK_GITLAB_CHAR=' ' -BARBUK_BITBUCKET_CHAR=' ' -BARBUK_GITHUB_CHAR=' ' -BARBUK_GIT_DEFAULT_CHAR=' ' -BARBUK_GIT_BRANCH_ICON='' -BARBUK_HG_CHAR='☿ ' -BARBUK_SVN_CHAR='⑆ ' -BARBUK_EXIT_CODE_ICON=' ' -BARBUK_PYTHON_VENV_CHAR=' ' -``` - -### Customize glyphs - -Define your custom glyphs before sourcing bash-it: - -```bash -export BARBUK_GITHUB_CHAR='•' -source "$BASH_IT"/bash_it.sh -``` - -## SSH prompt - -### Usage - -When using a ssh session, the theme will display `user@hostname`. -You can disable this information with `BARBUK_SSH_INFO`. - -The hostname is displayed in the FQDN format by default. You -can use the short hostname format with `BARBUK_HOST_INFO`. - -```bash -# short or long -export BARBUK_HOST_INFO=short -# true or false -export BARBUK_SSH_INFO=false -source "$BASH_IT"/bash_it.sh -``` - -### Keep theme with sudoer - -If you want the theme to persist using `sudo -s` in a ssh session, you need to configure sudo to keep the `HOME` and `SSH_CONNECTION` environment variables. - -`HOME` contains the path to the home directory of the current user. Keeping it will allow to use your user dotfiles when elevating privileges. - -Keeping `SSH_CONNECTION` env is necessary for ssh detection in the theme. - -Please refer to the following documentation for more information: - - [sudo manual](https://www.sudo.ws/man/1.8.13/sudoers.man.html) for `env_keep` configuration - - [openssh manual](https://linux.die.net/man/1/ssh) for information about `SSH_CONNECTION` environment - -```bash -cat << EOF > /etc/sudoers.d/keepenv -Defaults env_keep += HOME -Defaults env_keep += SSH_CONNECTION -EOF -chmod 400 /etc/sudoers.d/keepenv -``` - -## Examples - -### Clean - -```bash - ~ ❯ -``` - -### Git - -```bash -  ~/.dotfiles on  master ⤏ origin ↑2 •7 ✗ ❯ -``` - -### Ssh - -```bash -user@hostname in  ~/bash-it on  master ✓ ❯ -``` - -### Python venv - -```bash -  flask ~/test on  master ✓ ❯ -``` diff --git a/themes/bira/README.md b/themes/bira/README.md deleted file mode 100644 index 2438778e..00000000 --- a/themes/bira/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Bira - -This is a port of Oh My Zsh's ['Bira'](https://github.com/ohmyzsh/ohmyzsh/blob/master/themes/bira.zsh-theme) theme. It looks the same as the original, except for the following changes: - -- Exit code of last command is not shown -- More informative git prompt (if you want to keep it minimal, please read: https://github.com/Bash-it/bash-it#git-prompt) -- Position and colour of virtualenv prompt -- No ruby version prompt diff --git a/themes/brainy/README.md b/themes/brainy/README.md deleted file mode 100644 index dc6eaecd..00000000 --- a/themes/brainy/README.md +++ /dev/null @@ -1,123 +0,0 @@ -# Brainy theme - -Simple colorful terminal prompt theme (inspired by a number of themes). - -## Features - -### Prompt Segments - -- Username & Hostname -- Current Directory -- SCM Information -- Battery Charge -- Clock -- [Todo.txt](https://github.com/ginatrapani/todo.txt-cli) status -- Ruby Environment -- Python Environment -- Exit Code - -### Others - -- Indicator for cached `sudo` credential -- Indicator for ssh login -- `brainy` command for showing/hiding various prompt segments on-the-fly - -## Configuration - -Various prompt segments can be shown/hidden or modified according to your choice. There are two ways for doing that: - -1. On-the-fly using `brainy` command -2. Theme Environment Variables - -### On-the-fly using `brainy` command - -This theme provides a command for showing/hiding prompt segments. - -`brainy show ` - -`brainy hide ` - -Tab-completion for this command is enabled by default. - -Configuration specified by this command will only be applied to current and subsequent child shells. - -### Theme Environment Variables - -This is used for permanent settings that apply to all terminal sessions. You have to define the value of specific theme variables in your `bashrc` (or equivalent) file. - -The name of the variables are listed below along with their default values. - -#### User Information - -Indicator for cached `sudo` credential (see `sudo` manpage for more information): - -`THEME_SHOW_SUDO=true` - -#### SCM Information - -Information about SCM repository status: - -`THEME_SHOW_SCM=true` - -#### Ruby Environment - -Ruby environment version information: - -`THEME_SHOW_RUBY=false` - -#### Python Environment - -Python environment version information: - -`THEME_SHOW_PYTHON=false` - -#### ToDo.txt status - -[Todo.txt](https://github.com/ginatrapani/todo.txt-cli) status: - -`THEME_SHOW_TODO=false` - -#### Clock - -`THEME_SHOW_CLOCK=true` - -`THEME_CLOCK_COLOR=$bold_cyan` - -Format of the clock (see `date` manpage for more information): - -`THEME_CLOCK_FORMAT="%H:%M:%S"` - -#### Battery Charge - -Battery charge percentage: - -`THEME_SHOW_BATTERY=false` - -#### Exit Code - -Exit code of the last command: - -`THEME_SHOW_EXITCODE=true` - -## Prompt Segments Order - -Currently available prompt segments are: - -- battery -- char -- clock -- dir -- exitcode -- python -- ruby -- scm -- todo -- user_info - -Three environment variables can be defined to rearrange the segments order. The default values are: - -`___BRAINY_TOP_LEFT="user_info dir scm"` - -`___BRAINY_TOP_RIGHT="python ruby todo clock battery"` - -`___BRAINY_BOTTOM="exitcode char"` diff --git a/themes/codeword/README.md b/themes/codeword/README.md deleted file mode 100644 index c0cb8944..00000000 --- a/themes/codeword/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Single line PS1 theme w/realtime history among windows - - -Minimal theme overrides from bash_it base theming - - -## `user@host:path[virt-env][scm] $` -Breakdown of the segments: - -- **user@host:path** - *convienient for LAN based `ssh` and `scp` tasks* -- [**virtualenv**] - *only appears when activated* -- [**scm**] - *only appears when activated* -- **marker** - *$ or # depending on current user* - -### Examples - -```bash -user@example.lan:~ $ cd /tmp/foo/bar/baz -user@example.lan:/tmp/foo/bar/baz $ cd $HOME/workspace -user@example.lan:~/workspace $ cd sampleRepo/ -user@example.lan:~/workspace/sampleRepo [± |master ↑1 ↓3 {1} S:2 ?:1 ✗|] $ -``` diff --git a/themes/nwinkler_random_colors/README.md b/themes/nwinkler_random_colors/README.md deleted file mode 100644 index 69bfcd69..00000000 --- a/themes/nwinkler_random_colors/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# Nwinkler Random Color Theme - -## Description - -The *Nwinkler Random Color* Theme is based on the [nwinkler theme](https://github.com/Bash-it/bash-it/wiki/Themes#nwinkler), but it randomizes the colors for: - -* time -* username -* hostname -* path - -The random colors are chosen the first time this theme is used and saved to the `~/.nwinkler_random_colors` file. So, the next time you connect to the same machine, you will get the same colors. - -To force new random colors to be selected, run the command: - -```sh -randomize_nwinkler -``` - -## Screenshot - -Here it is in action: - -![alt text](screenshot.png "Nwinkler Random Color Theme in Action!") - -## Usage Scenario - -This theme is especially useful when connecting to many different machines and switching between them often. Yes, the hostname *is* present in the prompt. But I argue that it's a lot faster to get a "feel" of what machine you are currently on because of the custom colors on that machine's prompt than by reading the hostname. diff --git a/themes/powerline-multiline/README.md b/themes/powerline-multiline/README.md deleted file mode 100644 index 8f29f008..00000000 --- a/themes/powerline-multiline/README.md +++ /dev/null @@ -1,121 +0,0 @@ -# Powerline Multiline Theme - -A colorful multiline theme, where the first line shows information about your shell session (divided into two parts, left and right), and the second one is where the shell commands are introduced. - -**IMPORTANT:** This theme requires that [a font with the Powerline symbols](https://github.com/powerline/fonts) needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator. - -## Provided Information - -* Current path -* Current username and hostname -* Current time -* Current shell level -* Current dirstack level (`pushd` / `popd`) -* Current history number -* Current command number -* An indicator when connected by SSH -* An indicator when `sudo` has the credentials cached (see the `sudo` manpage for more info about this) -* An indicator when the current shell is inside the Vim editor -* Battery charging status (depends on the [../../plugins/available/battery.plugin.bash](battery plugin)) -* SCM Repository status (e.g. Git, SVN) -* The current Python environment (Virtualenv, venv, and Conda are supported) in use -* The current Ruby environment (rvm and rbenv are supported) in use -* Last command exit code (only shown when the exit code is greater than 0) - -## Configuration - -This theme is pretty configurable, all the configuration is done by setting environment variables. - -### User Information - -By default, the username and hostname are shown on the right hand side, but you can change this behavior by setting the value of the following variable: - -```bash -export POWERLINE_PROMPT_USER_INFO_MODE="sudo" -``` - -For now, the only supported value is `sudo`, which hides the username and hostname, and shows an indicator when `sudo` has the credentials cached. Other values have no effect at this time. - -### Clock Format - -By default, the current time is shown on the right hand side, you can change the format using the following variable: - -```bash -export THEME_CLOCK_FORMAT="%H:%M:%S" -``` - -The time/date is printed by the `date` command, so refer to its man page to change the format. - -### Soft Separators - -Adjacent segments having the same background color will use a less-pronouced (i.e. soft) separator between them. - -### Segment Order - -The contents of both prompt sides can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: - -* `aws_profile` - Show the current value of the `AWS_PROFILE` environment variable -* `battery` - Battery information (you'll need to enable the `battery` plugin) -* `clock` - Current time in `HH:MM:SS` format -* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`) -* `hostname` - Host name of machine -* `in_toolbox` - Show identifier if running inside a [toolbox](https://github.com/containers/toolbox) -* `in_vim` - Show identifier if running in `:terminal` from vim -* `k8s_context` - Show current kubernetes context -* `last_status` - Exit status of last run command -* `python_venv` - Python virtual environment information (`virtualenv`, `venv` - and `conda` supported) -* `ruby` - Current ruby version if using `rvm` -* `node` - Current node version (only `nvm` is supported) -* `scm` - Version control information, `git` -* `terraform` - Current terraform workspace -* `user_info` - Current user -* `wd` - Working directory, like `cwd` but doesn't show the full folder - hierarchy, only the directory you're currently in. -* `shlvl` - Show the current shell level (based on `SHLVL` environment variable), but only if you are not in root shell -* `dirstack` - Show the current dirstack level (based on `DIRSTACK` environment variable), but only if the stack is not empty -* `history_number` - Show current history number -* `command_number` - Show current command number - -Two variables can be defined to set the order of the prompt segments: - -```bash -export POWERLINE_LEFT_PROMPT="scm python_venv ruby cwd" -export POWERLINE_RIGHT_PROMPT="in_vim clock battery user_info" -``` - -The example values above are the current default values, but if you want to remove anything from the prompt, simply remove the "string" that represents the segment from the corresponding variable. - -### Padding - -To get the length of the left and right segments right, a _padding_ value is used. -In most cases, the default value (_2_) works fine, but on some operating systems, this needs to be adjusted. -One example is _macOS High Sierra_, where the default padding causes the right segment to extend to the next line. -On macOS High Sierra, the padding value needs to be changed to _3_ to make the theme look right. -This can be done by setting the `POWERLINE_PADDING` variable before Bash-it is loaded, e.g. in your `~/.bash_profile` or `~/.bashrc` file: - -```bash -export POWERLINE_PADDING=3 -``` - -### Compact Settings - -You can configure various aspects of the prompt to use less whitespace. Supported variables are: - -| Variable | Description -|--------------------------------------|------------ -|POWERLINE_COMPACT_BEFORE_SEPARATOR | Removes the leading space before each separator -|POWERLINE_COMPACT_AFTER_SEPARATOR | Removes the trailing space after each separator -|POWERLINE_COMPACT_BEFOR_FIRST_SEGMENT | Removes the leading space on the first segment -|POWERLINE_COMPACT_AFTER_LAST_SEGMENT | Removes the trailing space on the last segment -|POWERLINE_COMPACT_PROMPT | Removes the space after the prompt character -|POWERLINE_COMPACT | Enable all Compact settings (you can still override individual settings) - -The default value for all settings is `0` (disabled). Use `1` to enable. - -**Multiline Mode Right Prompt** - -For the purposes of the `Compact` settings, the segments within the **Right Prompt** are considered to run "right-to-left", i.e.: - -* The **right-most** segment is considered to be the `"first"` segment, while the **left-most** segment is considered to be the `"last"` -* The space to the **right** of the separator character is considered to be `"before"`, while the space to the **left** is considered to be `"after"` diff --git a/themes/powerline-naked/README.md b/themes/powerline-naked/README.md deleted file mode 100644 index bb709869..00000000 --- a/themes/powerline-naked/README.md +++ /dev/null @@ -1,92 +0,0 @@ -# Powerline Theme - -A colorful theme, where shows a lot information about your shell session. - -**IMPORTANT:** This theme requires that [a font with the Powerline symbols](https://github.com/powerline/fonts) needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator. - -## Provided Information - -* Current path -* Current username and hostname -* Current time -* Current shell level -* Current dirstack level (`pushd` / `popd`) -* Current history number -* Current command number -* An indicator when connected by SSH -* An indicator when `sudo` has the credentials cached (see the `sudo` manpage for more info about this) -* An indicator when the current shell is inside the Vim editor -* Battery charging status (depends on the [../../plugins/available/battery.plugin.bash](battery plugin)) -* SCM Repository status (e.g. Git, SVN) -* The current Kubernetes environment -* The current Python environment (Virtualenv, venv, and Conda are supported) in use -* The current Ruby environment (rvm and rbenv are supported) in use -* Last command exit code (only shown when the exit code is greater than 0) - -## Configuration - -This theme is pretty configurable, all the configuration is done by setting environment variables. - -### User Information - -By default, the username and hostname are shown, but you can change this behavior by setting the value of the following variable: - - POWERLINE_PROMPT_USER_INFO_MODE="sudo" - -For now, the only supported value is `sudo`, which hides the username and hostname, and shows an indicator when `sudo` has the credentials cached. Other values have no effect at this time. - -### Clock Format - -You can change the format using the following variable: - - THEME_CLOCK_FORMAT="%H:%M:%S" - -The time/date is printed by the `date` command, so refer to its man page to change the format. - -### Segment Order - -The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: - -* `aws_profile` - Show the current value of the `AWS_PROFILE` environment variable -* `battery` - Battery information (you'll need to enable the `battery` plugin) -* `clock` - Current time in `HH:MM:SS` format -* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`) -* `hostname` - Host name of machine -* `in_toolbox` - Show identifier if running inside a [toolbox](https://github.com/containers/toolbox) -* `in_vim` - Show identifier if running in `:terminal` from vim -* `k8s_context` - Show current kubernetes context -* `last_status` - Exit status of last run command -* `python_venv` - Python virtual environment information (`virtualenv`, `venv` - and `conda` supported) -* `ruby` - Current ruby version if using `rvm` -* `node` - Current node version (only `nvm` is supported) -* `scm` - Version control information, `git` -* `terraform` - Current terraform workspace -* `user_info` - Current user -* `wd` - Working directory, like `cwd` but doesn't show the full folder - hierarchy, only the directory you're currently in. -* `shlvl` - Show the current shell level (based on `SHLVL` environment variable), but only if you are not in root shell -* `dirstack` - Show the current dirstack level (based on `DIRSTACK` environment variable), but only if the stack is not empty -* `history_number` - Show current history number -* `command_number` - Show current command number - -A variable can be defined to set the order of the prompt segments: - - POWERLINE_PROMPT="user_info scm python_venv ruby cwd" - -The example values above are the current default values, but if you want to remove anything from the prompt, simply remove the "string" that represents the segment from the variable. - -### Compact Settings - -You can configure various aspects of the prompt to use less whitespace. Supported variables are: - -| Variable | Description -|--------------------------------------|------------ -|POWERLINE_COMPACT_BEFORE_SEPARATOR | Removes the leading space before each separator -|POWERLINE_COMPACT_AFTER_SEPARATOR | Removes the trailing space after each separator -|POWERLINE_COMPACT_BEFOR_FIRST_SEGMENT | Removes the leading space on the first segment -|POWERLINE_COMPACT_AFTER_LAST_SEGMENT | Removes the trailing space on the last segment -|POWERLINE_COMPACT_PROMPT | Removes the space after the prompt character -|POWERLINE_COMPACT | Enable all Compact settings (you can still override individual settings) - -The default value for all settings is `0` (disabled). Use `1` to enable. diff --git a/themes/powerline-plain/README.md b/themes/powerline-plain/README.md deleted file mode 100644 index bdd9fdd8..00000000 --- a/themes/powerline-plain/README.md +++ /dev/null @@ -1,91 +0,0 @@ -# Powerline Theme - -A colorful theme, where shows a lot information about your shell session. - -## Provided Information - -* Current path -* Current username and hostname -* Current time -* Current shell level -* Current dirstack level (`pushd` / `popd`) -* Current history number -* Current command number -* An indicator when connected by SSH -* An indicator when `sudo` has the credentials cached (see the `sudo` manpage for more info about this) -* An indicator when the current shell is inside the Vim editor -* Battery charging status (depends on the [../../plugins/available/battery.plugin.bash](battery plugin)) -* SCM Repository status (e.g. Git, SVN) -* The current Kubernetes environment -* The current Python environment (Virtualenv, venv, and Conda are supported) in use -* The current Ruby environment (rvm and rbenv are supported) in use -* Last command exit code (only shown when the exit code is greater than 0) - -## Configuration - -This theme is pretty configurable, all the configuration is done by setting environment variables. - -### User Information - -By default, the username and hostname are shown, but you can change this behavior by setting the value of the following variable: - - POWERLINE_PROMPT_USER_INFO_MODE="sudo" - -For now, the only supported value is `sudo`, which hides the username and hostname, and shows an indicator when `sudo` has the credentials cached. Other values have no effect at this time. - -### Clock Format - -You can change the format using the following variable: - - THEME_CLOCK_FORMAT="%H:%M:%S" - -The time/date is printed by the `date` command, so refer to its man page to change the format. - -### Segment Order - -The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: - -* `aws_profile` - Show the current value of the `AWS_PROFILE` environment variable -* `battery` - Battery information (you'll need to enable the `battery` plugin) -* `clock` - Current time in `HH:MM:SS` format -* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`) -* `hostname` - Host name of machine -* `in_toolbox` - Show identifier if running inside a [toolbox](https://github.com/containers/toolbox) -* `in_vim` - Show identifier if running in `:terminal` from vim -* `k8s_context` - Show current kubernetes context -* `last_status` - Exit status of last run command -* `python_venv` - Python virtual environment information (`virtualenv`, `venv` - and `conda` supported) -* `ruby` - Current ruby version if using `rvm` -* `node` - Current node version (only `nvm` is supported) -* `scm` - Version control information, `git` -* `terraform` - Current terraform workspace -* `user_info` - Current user -* `wd` - Working directory, like `cwd` but doesn't show the full folder - hierarchy, only the directory you're currently in. -* `shlvl` - Show the current shell level (based on `SHLVL` environment variable), but only if you are not in root shell -* `dirstack` - Show the current dirstack level (based on `DIRSTACK` environment variable), but only if the stack is not empty -* `history_number` - Show current history number -* `command_number` - Show current command number - -A variable can be defined to set the order of the prompt segments: - - POWERLINE_PROMPT="user_info scm python_venv ruby cwd" - -The example values above are the current default values, but if you want to remove anything from the prompt, simply remove the "string" that represents the segment from the variable. - -### Compact Settings - -You can configure various aspects of the prompt to use less whitespace. Supported variables are: - -| Variable | Description -|--------------------------------------|------------ -|POWERLINE_COMPACT_BEFORE_SEPARATOR | Removes the leading space before each separator -|POWERLINE_COMPACT_AFTER_SEPARATOR | Removes the trailing space after each separator -|POWERLINE_COMPACT_BEFOR_FIRST_SEGMENT | Removes the leading space on the first segment -|POWERLINE_COMPACT_AFTER_LAST_SEGMENT | Removes the trailing space on the last segment -|POWERLINE_COMPACT_PROMPT | Removes the space after the prompt character -|POWERLINE_COMPACT | Enable all Compact settings (you can still override individual settings) -|POWERLINE_PROMPT_AFTER | Adds characters after the prompt - -The default value for all settings is `0` (disabled). Use `1` to enable. diff --git a/themes/powerline/README.md b/themes/powerline/README.md deleted file mode 100644 index edb87de9..00000000 --- a/themes/powerline/README.md +++ /dev/null @@ -1,98 +0,0 @@ -# Powerline Theme - -A colorful theme, where shows a lot information about your shell session. - -**IMPORTANT:** This theme requires that [a font with the Powerline symbols](https://github.com/powerline/fonts) needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator. - -**NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If that is not the case (e.g. if you are running on a corporate network where `sudo` usage is tracked), you can set the flag 'export THEME_CHECK_SUDO=false' in your `~/.bashrc` or `~/.bash_profile` to disable the Powerline theme's `sudo` check. This will apply to all `powerline*` themes. - -## Provided Information - -* Current path -* Current username and hostname -* Current time -* Current shell level -* Current dirstack level (`pushd` / `popd`) -* Current history number -* Current command number -* An indicator when connected by SSH -* An indicator when `sudo` has the credentials cached (see the `sudo` manpage for more info about this) -* An indicator when the current shell is inside the Vim editor -* Battery charging status (depends on the [../../plugins/available/battery.plugin.bash](battery plugin)) -* SCM Repository status (e.g. Git, SVN) -* The current Kubernetes environment -* The current Python environment (Virtualenv, venv, and Conda are supported) in use -* The current Ruby environment (rvm and rbenv are supported) in use -* Last command exit code (only shown when the exit code is greater than 0) - -## Configuration - -This theme is pretty configurable, all the configuration is done by setting environment variables. - -### User Information - -By default, the username and hostname are shown, but you can change this behavior by setting the value of the following variable: - - POWERLINE_PROMPT_USER_INFO_MODE="sudo" - -For now, the only supported value is `sudo`, which hides the username and hostname, and shows an indicator when `sudo` has the credentials cached. Other values have no effect at this time. - -### Clock Format - -You can change the format using the following variable: - - THEME_CLOCK_FORMAT="%H:%M:%S" - -The time/date is printed by the `date` command, so refer to its man page to change the format. - -### Soft Separators - -Adjacent segments having the same background color will use a less-pronouced (i.e. soft) separator between them. - -### Segment Order - -The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: - -* `aws_profile` - Show the current value of the `AWS_PROFILE` environment variable -* `battery` - Battery information (you'll need to enable the `battery` plugin) -* `clock` - Current time in `HH:MM:SS` format -* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`) -* `hostname` - Host name of machine -* `in_toolbox` - Show identifier if running inside a [toolbox](https://github.com/containers/toolbox) -* `in_vim` - Show identifier if running in `:terminal` from vim -* `k8s_context` - Show current kubernetes context -* `last_status` - Exit status of last run command -* `python_venv` - Python virtual environment information (`virtualenv`, `venv` - and `conda` supported) -* `ruby` - Current ruby version if using `rvm` -* `node` - Current node version (only `nvm` is supported) -* `scm` - Version control information, `git` -* `terraform` - Current terraform workspace -* `user_info` - Current user -* `wd` - Working directory, like `cwd` but doesn't show the full folder - hierarchy, only the directory you're currently in. -* `shlvl` - Show the current shell level (based on `SHLVL` environment variable), but only if you are not in root shell -* `dirstack` - Show the current dirstack level (based on `DIRSTACK` environment variable), but only if the stack is not empty -* `history_number` - Show current history number -* `command_number` - Show current command number - -A variable can be defined to set the order of the prompt segments: - - POWERLINE_PROMPT="user_info scm python_venv ruby cwd" - -The example values above are the current default values, but if you want to remove anything from the prompt, simply remove the "string" that represents the segment from the variable. - -### Compact Settings - -You can configure various aspects of the prompt to use less whitespace. Supported variables are: - -| Variable | Description -|--------------------------------------|------------ -|POWERLINE_COMPACT_BEFORE_SEPARATOR | Removes the leading space before each separator -|POWERLINE_COMPACT_AFTER_SEPARATOR | Removes the trailing space after each separator -|POWERLINE_COMPACT_BEFOR_FIRST_SEGMENT | Removes the leading space on the first segment -|POWERLINE_COMPACT_AFTER_LAST_SEGMENT | Removes the trailing space on the last segment -|POWERLINE_COMPACT_PROMPT | Removes the space after the prompt character -|POWERLINE_COMPACT | Enable all Compact settings (you can still override individual settings) - -The default value for all settings is `0` (disabled). Use `1` to enable. diff --git a/themes/radek/README.md b/themes/radek/README.md deleted file mode 100644 index 7dc521a2..00000000 --- a/themes/radek/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# Radek Theme - -A colorful theme for Python developers. -It does not have any requirments. - -## Provided Information - -* Current username and hostname -* Current path -* Git repository status -* Current Python environment (venv, Conda ) -* Current Python version - -## Examples - -```bash -[radek@photon][~/src/nokia2/cbis] ±[master → origin ↑1 {1}✓][venv-cbis][py-3.7.5] -→ -``` diff --git a/themes/redline/README.md b/themes/redline/README.md deleted file mode 100644 index 0705612e..00000000 --- a/themes/redline/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# Redline Theme - -changed up the powerline base a little. - -It plays nicest with this font: [DroidSansMonoForPowerline](https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/DroidSansMono) - -Read the [powerline theme documentation](https://github.com/Bash-it/bash-it/blob/master/themes/powerline/README.md) - - -## added -* hostname -* distro logo - -## changed -* sudo credential check -* required font -* some icons - -Works real good like with: -```bash -## set the theme -export BASH_IT_THEME='redline' - -# Set this to false to turn off version control status checking within the prompt for all themes -export SCM_CHECK=true - -## Set Xterm/screen/Tmux title with only a short hostname. -export SHORT_HOSTNAME=$(hostname -s) - -## enable sudo prompt -export POWERLINE_PROMPT_USER_INFO_MODE="sudo" - -## prompt part string -export POWERLINE_PROMPT="python_venv user_info hostname cwd scm" - -``` - -## enable your distro logo with -```bash -export POWERLINE_PROMPT_DISTRO_LOGO="yes" -``` - -![screenshot](screenshot.png?raw=true) From 8198fafbd934a854717f36288c50ae7fd1845086 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Fri, 4 Dec 2020 18:32:48 +0200 Subject: [PATCH 51/68] Add github action to replace travis --- .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..03b75882 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: CI + +# Triggers the workflow on push or pull request events +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + bats-test: + strategy: + matrix: + os: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04, macos-10.15, macos-11.0] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + - name: Install greadlink + if: startsWith(runner.os, 'macOS') + run: brew install coreutils + - name: Test code + run: test/run + + build-docs: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install docs dependencies + run: python3 -m pip install -r docs/requirements.txt + - name: Build the docs + run: sphinx-build -W -b html docs docs/_build/html + + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.14 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install shfmt + run: GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt + - name: Install shellcheck + run: brew install shellcheck + - name: Install pre-commit + run: python3 -m pip install -r test/lint-requirements.txt + - name: Run lint + run: ./lint_clean_files.sh From 4a5ea95e2e778a847b5ff6af7ccae355f43974cf Mon Sep 17 00:00:00 2001 From: NariyasuHeseri <31871512+NariyasuHeseri@users.noreply.github.com> Date: Sun, 6 Dec 2020 01:33:50 +0900 Subject: [PATCH 52/68] Add completion for pipx. (#1719) * Add completion for pipx. * Add pipx completion to clean_files.txt. * Format pipx.completion.bash to match the project's coding style. * Format pipx.completion.bash with ./lint_clean_files.sh. --- clean_files.txt | 1 + completion/available/pipx.completion.bash | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 completion/available/pipx.completion.bash diff --git a/clean_files.txt b/clean_files.txt index 52981cf4..cade6895 100644 --- a/clean_files.txt +++ b/clean_files.txt @@ -31,3 +31,4 @@ themes/powerline # completions # completion/available/rustup.completion.bash +completion/available/pipx.completion.bash diff --git a/completion/available/pipx.completion.bash b/completion/available/pipx.completion.bash new file mode 100644 index 00000000..9e34f076 --- /dev/null +++ b/completion/available/pipx.completion.bash @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +# pipx completion + +if _command_exists register-python-argcomplete && _command_exists pipx; then + eval "$(register-python-argcomplete pipx)" +fi From 4d51bfcaf42ea0413d1e65bdd42785b1e37c1207 Mon Sep 17 00:00:00 2001 From: Nariyasu Heseri Date: Sun, 6 Dec 2020 15:22:36 +0900 Subject: [PATCH 53/68] Add cargo completion --- clean_files.txt | 3 ++- completion/available/cargo.completion.bash | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 completion/available/cargo.completion.bash diff --git a/clean_files.txt b/clean_files.txt index cade6895..47ae7e93 100644 --- a/clean_files.txt +++ b/clean_files.txt @@ -30,5 +30,6 @@ themes/powerline # completions # -completion/available/rustup.completion.bash +completion/available/cargo.completion.bash completion/available/pipx.completion.bash +completion/available/rustup.completion.bash diff --git a/completion/available/cargo.completion.bash b/completion/available/cargo.completion.bash new file mode 100644 index 00000000..46b399e4 --- /dev/null +++ b/completion/available/cargo.completion.bash @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# cargo (Rust package manager) completion + +if _binary_exists rustup && _binary_exists cargo; then + eval "$(rustup completions bash cargo)" +fi From 7f1aa107d8874be6bd031fe21882015c543dcc3a Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sun, 6 Dec 2020 21:43:59 +0200 Subject: [PATCH 54/68] ci: Delete travis settings as they no longer support OSS Very sad indeed --- .travis.yml | 60 ----------------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d199e9d6..00000000 --- a/.travis.yml +++ /dev/null @@ -1,60 +0,0 @@ -# YAML anchors need to appear first. -# Keys starting with an underscore are the custom ones, refer to -# https://docs.travis-ci.com/user/build-config-yaml#private-keys-as-yaml-anchors-and-aliases-and-external-tooling - -_native_job: &native_job - script: | - test/run - -language: shell - -os: linux - -dist: xenial - -cache: - directories: - - "${HOME}/.cache/pip" - - "${HOME}/.cache/pre-commit" - - "${HOME}/.pre-commit-venv" - - "${HOME}/bin" - - /usr/lib/python3.8 - -jobs: - include: - - language: python - python: 3.8 - name: docs - dist: bionic - install: - pip3 install -r docs/requirements.txt; - script: - sphinx-build -W -b html docs docs/_build/html; - - - language: go - go: "1.14" - name: pre-commit lint - dist: bionic - sudo: required - before_script: - GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt; - curl https://pre-commit.com/install-local.py | python3 - - script: - ./lint_clean_files.sh; - - - <<: *native_job - name: Ubuntu 16.04 - - - <<: *native_job - name: Ubuntu 18.04 - dist: bionic - - - <<: *native_job - name: MacOS xcode9.4 - os: osx - osx_image: xcode9.4 # Default xcode on Travis. - - - <<: *native_job - name: MacOS xcode11.5 - os: osx - osx_image: xcode11.5 # Latest xcode on Travis. From 7dcf4dd186f58e6b2d1e2090dd3a0c762911e134 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sun, 6 Dec 2020 23:02:16 +0200 Subject: [PATCH 55/68] Update contribution.rst Now includes relevant change about `clean_files.txt` and improves the part about our coding style --- docs/contributing.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/contributing.rst b/docs/contributing.rst index e2c3f5ca..9964e03c 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -38,8 +38,9 @@ Code Style ---------- -* Try to stick to the existing code style. Please don't reformat or change the syntax of existing code simply because you don't like that style. -* Indentation is using spaces, not tabs. Most of the code is indented with 2 spaces, some with 4 spaces. Please try to stick to 2 spaces. +* 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. +* 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 `_\ , 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``. Don't use underscores, e.g. ``my_new_function``. From 0e904abd0db5270e783cba7ff9811862c240660c Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sun, 6 Dec 2020 23:08:42 +0200 Subject: [PATCH 56/68] github: Add no-response bot --- .github/no-response.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/no-response.yml diff --git a/.github/no-response.yml b/.github/no-response.yml new file mode 100644 index 00000000..e80a98be --- /dev/null +++ b/.github/no-response.yml @@ -0,0 +1,11 @@ +# Configuration for probot-no-response - https://github.com/probot/no-response + +# Number of days of inactivity before an Issue is closed for lack of response +daysUntilClose: 14 +# Label requiring a response +responseRequiredLabel: waiting-for-response +# Comment to post when closing an Issue for lack of response. Set to `false` to disable +closeComment: > + This issue has been automatically closed because there has been no response + to our request for more information from the original author. + You can always reopen the issue if needed. From 5a85126241056046359e6025352ade717a9d8d67 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Mon, 7 Dec 2020 18:06:27 +0200 Subject: [PATCH 57/68] complete cleanup of the knife completion file --- clean_files.txt | 1 + completion/available/knife.completion.bash | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/clean_files.txt b/clean_files.txt index 47ae7e93..8c4e5926 100644 --- a/clean_files.txt +++ b/clean_files.txt @@ -31,5 +31,6 @@ themes/powerline # completions # completion/available/cargo.completion.bash +completion/available/knife.completion.bash completion/available/pipx.completion.bash completion/available/rustup.completion.bash diff --git a/completion/available/knife.completion.bash b/completion/available/knife.completion.bash index 8c6fef9b..cf050e36 100644 --- a/completion/available/knife.completion.bash +++ b/completion/available/knife.completion.bash @@ -44,20 +44,22 @@ _KAC_regen_cache() { local CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME" local TMP_FILE=$(mktemp "$_KAC_CACHE_TMP_DIR/$CACHE_NAME.XXXX") shift 1 - "$@" > "$TMP_FILE" 2> /dev/null # discard the temp file if it's empty AND the previous command didn't exit successfully, but still mark the cache as updated - [[ $? != 0 ]] && [[ $(wc -l "$TMP_FILE") == 0 ]] && rm -f "$TMP_FILE" && touch "$CACHE_PATH" && return 1 \ - || mv -f "$TMP_FILE" "$CACHE_PATH" + if ! "$@" > "$TMP_FILE" 2> /dev/null; then + [[ $(wc -l "$TMP_FILE") == 0 ]] && rm -f "$TMP_FILE" && touch "$CACHE_PATH" && return 1 + else + mv -f "$TMP_FILE" "$CACHE_PATH" + fi } # cached files can't have spaces in their names _KAC_get_cache_name_from_command() { - echo "$@" | sed 's/ /_SPACE_/g' + echo "${@/ /_SPACE_}" } # the reverse operation from the function above _KAC_get_command_from_cache_name() { - echo "$@" | sed 's/_SPACE_/ /g' + echo "${@/_SPACE_/ }" } # given a command as argument, it fetches the cache for that command if it can find it @@ -82,7 +84,7 @@ _KAC_get_and_regen_cache() { _KAC_clean_cache() { local FILE CMD # delete all obsolete temp files, could be lingering there for any kind of crash in the caching process - for FILE in $(\ls "$_KAC_CACHE_TMP_DIR"); do + for FILE in "$_KAC_CACHE_TMP_DIR"/*; do _KAC_is_file_newer_than "$FILE" "$_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE" || rm -f "$FILE" done # refresh really stale caches @@ -192,8 +194,8 @@ _knife() { _KAC_get_and_regen_cache "$REGEN_CMD" LIST="$LIST $(cat "$_KAC_CACHE_PATH")" done + # shellcheck disable=SC2207,SC2086 COMPREPLY=($(compgen -W "${LIST}" -- ${COMP_WORDS[COMP_CWORD]})) } -#complete -f -F _knife knife complete -F _knife knife From 0e6f10f48930c4417f21a680d15e6eaddf102e31 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Mon, 7 Dec 2020 21:38:35 +0200 Subject: [PATCH 58/68] docs: Add github action CI badge --- docs/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index 8867f05a..f8e94995 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,6 +1,5 @@ # Bash-it - -[![Build Status](https://travis-ci.com/Bash-it/bash-it.svg?branch=master)](https://travis-ci.com/Bash-it/bash-it) +![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) **Bash-it** is a collection of community Bash commands and scripts for Bash 3.2+. From 3019dc331d840ea2b275f87342d8520397b22000 Mon Sep 17 00:00:00 2001 From: egvimo Date: Fri, 11 Dec 2020 15:32:23 +0100 Subject: [PATCH 59/68] Add option to append template to existing config (#1723) * Add option to append template to existing config * Add test for append-to-config option Co-authored-by: Egor Moor --- docs/installation.rst | 1 + install.sh | 38 ++++++++++++++++++++++++++++---------- test/install/install.bats | 25 +++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 10 deletions(-) diff --git a/docs/installation.rst b/docs/installation.rst index 12cc9437..9688af20 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -19,6 +19,7 @@ The install script can take the following options: * ``--interactive``\ : Asks the user which aliases, completions and plugins to enable. * ``--silent``\ : Ask nothing and install using default settings. * ``--no-modify-config``\ : Do not modify the existing config file (\ ``~/.bash_profile`` or ``~/.bashrc``\ ). +* ``--append-to-config``\ : Back up existing config file and append bash-it templates at the end. When run without the ``--interactive`` switch, Bash-it only enables a sane default set of functionality to keep your shell clean and to avoid issues with missing dependencies. Feel free to enable the tools you want to use after the installation. diff --git a/install.sh b/install.sh index 8250c3df..b9ea5c68 100755 --- a/install.sh +++ b/install.sh @@ -10,6 +10,7 @@ function show_usage() { echo "--silent (-s): Install default settings without prompting for input"; echo "--interactive (-i): Interactively choose plugins" echo "--no-modify-config (-n): Do not modify existing config file" + echo "--append-to-config (-a): Keep existing config file and append bash-it templates at the end" exit 0; } @@ -56,15 +57,27 @@ function load_some() { done } -# Back up existing profile and create new one for bash-it -function backup_new() { +# Back up existing profile +function backup() { test -w "$HOME/$CONFIG_FILE" && cp -aL "$HOME/$CONFIG_FILE" "$HOME/$CONFIG_FILE.bak" && echo -e "\033[0;32mYour original $CONFIG_FILE has been backed up to $CONFIG_FILE.bak\033[0m" +} + +# Back up existing profile and create new one for bash-it +function backup_new() { + backup sed "s|{{BASH_IT}}|$BASH_IT|" "$BASH_IT/template/bash_profile.template.bash" > "$HOME/$CONFIG_FILE" echo -e "\033[0;32mCopied the template $CONFIG_FILE into ~/$CONFIG_FILE, edit this file to customize bash-it\033[0m" } +# Back up existing profile and append bash-it templates at the end +function backup_append() { + backup + (sed "s|{{BASH_IT}}|$BASH_IT|" "$BASH_IT/template/bash_profile.template.bash" | tail -n +2) >> "$HOME/$CONFIG_FILE" + echo -e "\033[0;32mBash-it template has been added to your $CONFIG_FILE\033[0m" +} + for param in "$@"; do shift case "$param" in @@ -72,18 +85,20 @@ for param in "$@"; do "--silent") set -- "$@" "-s" ;; "--interactive") set -- "$@" "-i" ;; "--no-modify-config") set -- "$@" "-n" ;; + "--append-to-config") set -- "$@" "-a" ;; *) set -- "$@" "$param" esac done OPTIND=1 -while getopts "hsin" opt +while getopts "hsina" opt do case "$opt" in "h") show_usage; exit 0 ;; "s") silent=true ;; "i") interactive=true ;; "n") no_modify_config=true ;; + "a") append_to_config=true ;; "?") show_usage >&2; exit 1 ;; esac done @@ -94,6 +109,11 @@ if [[ $silent ]] && [[ $interactive ]]; then exit 1; fi +if [[ $no_modify_config ]] && [[ $append_to_config ]]; then + echo -e "\033[91mOptions --no-modify-config and --append-to-config are mutually exclusive. Please choose one or the other.\033[m" + exit 1; +fi + BASH_IT="$(cd "$(dirname "$0")" && pwd)" case $OSTYPE in @@ -127,16 +147,11 @@ if ! [[ $silent ]] && ! [[ $no_modify_config ]]; then done fi - while ! [ $silent ]; do + while ! [ $append_to_config ]; do read -e -n 1 -r -p "Would you like to keep your $CONFIG_FILE and append bash-it templates at the end? [y/N] " choice case $choice in [yY]) - test -w "$HOME/$CONFIG_FILE" && - cp -aL "$HOME/$CONFIG_FILE" "$HOME/$CONFIG_FILE.bak" && - echo -e "\033[0;32mYour original $CONFIG_FILE has been backed up to $CONFIG_FILE.bak\033[0m" - - (sed "s|{{BASH_IT}}|$BASH_IT|" "$BASH_IT/template/bash_profile.template.bash" | tail -n +2) >> "$HOME/$CONFIG_FILE" - echo -e "\033[0;32mBash-it template has been added to your $CONFIG_FILE\033[0m" + backup_append break ;; [nN]|"") @@ -148,6 +163,9 @@ if ! [[ $silent ]] && ! [[ $no_modify_config ]]; then ;; esac done +elif [[ $append_to_config ]]; then + # backup/append + backup_append elif [[ $silent ]] && ! [[ $no_modify_config ]]; then # backup/new by default backup_new diff --git a/test/install/install.bats b/test/install/install.bats index 01776f25..7b4b5347 100644 --- a/test/install/install.bats +++ b/test/install/install.bats @@ -59,3 +59,28 @@ function local_setup { assert_failure } + +@test "install: verify that no-modify-config and append-to-config can not be used at the same time" { + cd "$BASH_IT" + + run ./install.sh --silent --no-modify-config --append-to-config + + assert_failure +} + +@test "install: verify that the template is appended" { + cd "$BASH_IT" + + touch "$BASH_IT_TEST_HOME/$BASH_IT_CONFIG_FILE" + echo "test file content" > "$BASH_IT_TEST_HOME/$BASH_IT_CONFIG_FILE" + + ./install.sh --silent --append-to-config + + assert_file_exist "$BASH_IT_TEST_HOME/$BASH_IT_CONFIG_FILE" + assert_file_exist "$BASH_IT_TEST_HOME/$BASH_IT_CONFIG_FILE.bak" + + run cat $BASH_IT_TEST_HOME/$BASH_IT_CONFIG_FILE + + assert_line "test file content" + assert_line "source \"\$BASH_IT\"/bash_it.sh" +} From 4dfd8bcc42e4180e5c87b9347f929ee670af6929 Mon Sep 17 00:00:00 2001 From: Ron Green <11993626+georgettica@users.noreply.github.com> Date: Sun, 13 Dec 2020 22:58:01 +0200 Subject: [PATCH 60/68] feat(git-aliases): add checkout with username (fixes #1712) (#1732) * feat(git-aliases): add checkout with username this can be useful for creating a branch with a common prefix * fix(git-alais): change quotes --- aliases/available/git.aliases.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index 0803dee2..a46b44fa 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -65,6 +65,7 @@ alias gco='git checkout' alias gcom='git checkout master' alias gcb='git checkout -b' alias gcob='git checkout -b' +alias gcobu='git checkout -b ${USER}/' alias gct='git checkout --track' alias gcpd='git checkout master; git pull; git branch -D' alias gexport='git archive --format zip --output' From 7b21a76c6af879618a4303884c2b4e21a60dec9c Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sun, 13 Dec 2020 23:15:05 +0200 Subject: [PATCH 61/68] docs: themes-list: Use gh-pages instead of wiki Also note that its only most of the themes, not all of them --- docs/themes-list/index.rst | 262 ++++++++++++++++++------------------- 1 file changed, 131 insertions(+), 131 deletions(-) diff --git a/docs/themes-list/index.rst b/docs/themes-list/index.rst index 0df4c087..e15cd313 100644 --- a/docs/themes-list/index.rst +++ b/docs/themes-list/index.rst @@ -3,7 +3,7 @@ List of Themes ============== -Below is a list of all of the themes (with screenshots) that `bash-it `_ ships with. +Below is a list of most of the themes (with screenshots) that `bash-it `_ ships with. Alphabetical List: ------------------ @@ -12,13 +12,13 @@ Bakke ^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/bakke-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/bakke-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/bakke-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/bakke-black.jpg :alt: Bakke -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/bakke-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/bakke-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/bakke-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/bakke-white.jpg :alt: Bakke @@ -28,13 +28,13 @@ BarbUk ^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/BarbUk-black.png - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/BarbUk-black.png +.. image:: https://bash-it.github.io/bash-it/docs/images/BarbUk-black.png + :target: https://bash-it.github.io/bash-it/docs/images/BarbUk-black.png :alt: BarbUk -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/BarbUk-white.png - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/BarbUk-white.png +.. image:: https://bash-it.github.io/bash-it/docs/images/BarbUk-white.png + :target: https://bash-it.github.io/bash-it/docs/images/BarbUk-white.png :alt: BarbUk @@ -44,13 +44,13 @@ Bobby ^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/bobby-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/bobby-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/bobby-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/bobby-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/bobby-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/bobby-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/bobby-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/bobby-white.jpg :alt: @@ -60,8 +60,8 @@ Brunton ^^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/brunton-black.png - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/brunton-black.png +.. image:: https://bash-it.github.io/bash-it/docs/images/brunton-black.png + :target: https://bash-it.github.io/bash-it/docs/images/brunton-black.png :alt: @@ -71,13 +71,13 @@ Candy ^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/candy-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/candy-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/candy-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/candy-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/candy-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/candy-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/candy-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/candy-white.jpg :alt: @@ -87,13 +87,13 @@ Clean ^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/clean-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/clean-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/clean-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/clean-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/clean-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/clean-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/clean-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/clean-white.jpg :alt: @@ -103,13 +103,13 @@ Demula ^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/demula-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/demula-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/demula-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/demula-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/demula-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/demula-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/demula-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/demula-white.jpg :alt: @@ -119,13 +119,13 @@ DOS ^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/dos-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/dos-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/dos-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/dos-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/dos-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/dos-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/dos-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/dos-white.jpg :alt: @@ -135,13 +135,13 @@ DoubleTime ^^^^^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/doubletime-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/doubletime-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/doubletime-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/doubletime-white.jpg :alt: @@ -151,13 +151,13 @@ DoubleTime Multiline ^^^^^^^^^^^^^^^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime_multiline-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime_multiline-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/doubletime_multiline-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/doubletime_multiline-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime_multiline-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime_multiline-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/doubletime_multiline-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/doubletime_multiline-white.jpg :alt: @@ -167,13 +167,13 @@ Doubletime Multiline Python Only ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime_multiline_pyonly-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime_multiline_pyonly-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/doubletime_multiline_pyonly-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/doubletime_multiline_pyonly-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime_multiline_pyonly-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/doubletime_multiline_pyonly-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/doubletime_multiline_pyonly-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/doubletime_multiline_pyonly-white.jpg :alt: @@ -183,13 +183,13 @@ Envy ^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/envy-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/envy-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/envy-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/envy-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/envy-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/envy-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/envy-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/envy-white.jpg :alt: @@ -217,13 +217,13 @@ Mr Briggs ^^^^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/mbriggs-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/mbriggs-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/mbriggs-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/mbriggs-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/mbriggs-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/mbriggs-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/mbriggs-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/mbriggs-white.jpg :alt: @@ -233,13 +233,13 @@ Minimal ^^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/minimal-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/minimal-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/minimal-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/minimal-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/minimal-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/minimal-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/minimal-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/minimal-white.jpg :alt: @@ -249,13 +249,13 @@ Modern ^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/modern-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/modern-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/modern-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/modern-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/modern-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/modern-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/modern-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/modern-white.jpg :alt: @@ -265,13 +265,13 @@ Modern T ^^^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/modern-t-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/modern-t-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/modern-t-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/modern-t-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/modern-t-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/modern-t-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/modern-t-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/modern-t-white.jpg :alt: @@ -292,13 +292,13 @@ n0Qorg ^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/n0qorg-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/n0qorg-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/n0qorg-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/n0qorg-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/n0qorg-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/n0qorg-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/n0qorg-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/n0qorg-white.jpg :alt: @@ -308,13 +308,13 @@ NWinkler ^^^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/nwinkler-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/nwinkler-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/nwinkler-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/nwinkler-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/nwinkler-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/nwinkler-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/nwinkler-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/nwinkler-white.jpg :alt: @@ -324,13 +324,13 @@ Pete ^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/pete-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/pete-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/pete-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/pete-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/pete-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/pete-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/pete-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/pete-white.jpg :alt: @@ -340,13 +340,13 @@ Powerline ^^^^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/powerline-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/powerline-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/powerline-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/powerline-white.jpg :alt: @@ -356,13 +356,13 @@ Powerline Naked ^^^^^^^^^^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-naked-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-naked-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/powerline-naked-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/powerline-naked-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-naked-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-naked-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/powerline-naked-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/powerline-naked-white.jpg :alt: @@ -372,13 +372,13 @@ Powerline Plain ^^^^^^^^^^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-plain-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-plain-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/powerline-plain-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/powerline-plain-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-plain-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/powerline-plain-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/powerline-plain-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/powerline-plain-white.jpg :alt: @@ -388,13 +388,13 @@ Pure ^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/pure-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/pure-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/pure-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/pure-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/pure-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/pure-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/pure-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/pure-white.jpg :alt: @@ -404,13 +404,13 @@ RainbowBrite ^^^^^^^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/rainbowbrite-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/rainbowbrite-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/rainbowbrite-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/rainbowbrite-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/rainbowbrite-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/rainbowbrite-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/rainbowbrite-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/rainbowbrite-white.jpg :alt: @@ -420,13 +420,13 @@ R Jorgenson ^^^^^^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/rjorgenson-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/rjorgenson-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/rjorgenson-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/rjorgenson-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/rjorgenson-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/rjorgenson-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/rjorgenson-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/rjorgenson-white.jpg :alt: @@ -436,13 +436,13 @@ Sexy ^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/sexy-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/sexy-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/sexy-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/sexy-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/sexy-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/sexy-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/sexy-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/sexy-white.jpg :alt: @@ -452,13 +452,13 @@ Simple ^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/simple-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/simple-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/simple-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/simple-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/simple-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/simple-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/simple-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/simple-white.jpg :alt: @@ -468,13 +468,13 @@ SirUp ^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/sirup-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/sirup-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/sirup-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/sirup-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/sirup-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/sirup-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/sirup-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/sirup-white.jpg :alt: @@ -484,13 +484,13 @@ Standard ^^^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/standard-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/standard-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/standard-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/standard-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/standard-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/standard-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/standard-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/standard-white.jpg :alt: @@ -500,13 +500,13 @@ Tonka ^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/tonka-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/tonka-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/tonka-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/tonka-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/tonka-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/tonka-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/tonka-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/tonka-white.jpg :alt: @@ -516,13 +516,13 @@ Tylenol ^^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/tylenol-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/tylenol-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/tylenol-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/tylenol-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/tylenol-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/tylenol-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/tylenol-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/tylenol-white.jpg :alt: @@ -532,13 +532,13 @@ Zitron ^^^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/zitron-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/zitron-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/zitron-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/zitron-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/zitron-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/zitron-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/zitron-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/zitron-white.jpg :alt: @@ -548,11 +548,11 @@ Zork ^^^^ -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/zork-black.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/zork-black.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/zork-black.jpg + :target: https://bash-it.github.io/bash-it/docs/images/zork-black.jpg :alt: -.. image:: https://raw.github.com/wiki/revans/bash-it/images/screenshots/zork-white.jpg - :target: https://raw.github.com/wiki/revans/bash-it/images/screenshots/zork-white.jpg +.. image:: https://bash-it.github.io/bash-it/docs/images/zork-white.jpg + :target: https://bash-it.github.io/bash-it/docs/images/zork-white.jpg :alt: From bced06994b227cff5ad6a3d1c7002943da7913f8 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Fri, 30 Oct 2020 19:06:05 +0200 Subject: [PATCH 62/68] Move theme documentation to be under docs/themes-list --- docs/themes-list/atomic.rst | 200 ++++++++++++++++++ docs/themes-list/barbuk.rst | 124 +++++++++++ docs/themes-list/bira.rst | 12 ++ docs/themes-list/brainy.rst | 145 +++++++++++++ docs/themes-list/codeword.rst | 28 +++ docs/themes-list/index.rst | 18 +- .../themes-list/nwinkler_random_colors.png | Bin docs/themes-list/nwinkler_random_colors.rst | 39 ++++ docs/themes-list/powerline-multiline.rst | 144 +++++++++++++ docs/themes-list/powerline-naked.rst | 121 +++++++++++ docs/themes-list/powerline-plain.rst | 121 +++++++++++ docs/themes-list/powerline.rst | 128 +++++++++++ docs/themes-list/radek.rst | 25 +++ .../themes-list/redline.png | Bin docs/themes-list/redline.rst | 56 +++++ 15 files changed, 1158 insertions(+), 3 deletions(-) create mode 100644 docs/themes-list/atomic.rst create mode 100644 docs/themes-list/barbuk.rst create mode 100644 docs/themes-list/bira.rst create mode 100644 docs/themes-list/brainy.rst create mode 100644 docs/themes-list/codeword.rst rename themes/nwinkler_random_colors/screenshot.png => docs/themes-list/nwinkler_random_colors.png (100%) create mode 100644 docs/themes-list/nwinkler_random_colors.rst create mode 100644 docs/themes-list/powerline-multiline.rst create mode 100644 docs/themes-list/powerline-naked.rst create mode 100644 docs/themes-list/powerline-plain.rst create mode 100644 docs/themes-list/powerline.rst create mode 100644 docs/themes-list/radek.rst rename themes/redline/screenshot.png => docs/themes-list/redline.png (100%) create mode 100644 docs/themes-list/redline.rst diff --git a/docs/themes-list/atomic.rst b/docs/themes-list/atomic.rst new file mode 100644 index 00000000..7d471ba9 --- /dev/null +++ b/docs/themes-list/atomic.rst @@ -0,0 +1,200 @@ +.. _atomic: + +Atomic theme +============ + +The Best ColorFull terminal prompt theme inspired by a number of themes and based on the theme of @MunifTanjim :ref:`brainy `. + +Supported on all operating systems. + +In constant maintenance and improvement + + +.. image:: https://raw.githubusercontent.com/lfelipe1501/lfelipe-projects/master/AtomicTheme.gif + :target: https://raw.githubusercontent.com/lfelipe1501/lfelipe-projects/master/AtomicTheme.gif + :alt: Atomic-Theme + + +Install Theme +------------- + +Manually +^^^^^^^^ + +You can install the theme manually by following these steps: +Edit your modified config ``~/.bashrc`` file in order to customize Bash-it, set ``BASH_IT_THEME`` to the theme name ``atomic``. + +Examples: + +.. code-block:: bash + + # Use the "atomic" theme + export BASH_IT_THEME="atomic" + +Automatically via terminal +^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +#. You can install the theme automatically using the ``sed`` command from your Linux or OSX Terminal. +#. On macOS, the ~/.bash_profile is used, not the ~/.bashrc. +#. For installation on windows you should use `\ ``Git-Bash`` `_ or make sure the terminal emulator you use (ej: cygwin, mintty, etc) has the ``sed`` command installed. + +Command to execute For Windows and Linux: + +.. code-block:: bash + + # Set the "atomic" theme replacing the theme you are using of bash-it + sed -i 's/'"$BASH_IT_THEME"'/atomic/g' ~/.bashrc + +Command to execute for macOS: + +.. code-block:: bash + + # Set the "atomic" theme replacing the theme you are using of bash-it + sed -i '' 's/'"$BASH_IT_THEME"'/atomic/g' ~/.bash_profile + +Features +-------- + +Prompt Segments +^^^^^^^^^^^^^^^ + + +* Username & Hostname +* Current Directory +* SCM Information +* Battery Charge +* Clock +* `Todo.txt `_ status +* Ruby Environment +* Python Environment +* Exit Code + +Others +^^^^^^ + + +* Indicator for cached ``sudo`` credential +* Indicator for abort (ctrl + C) the current task and regain user control +* ``atomic`` command for showing/hiding various prompt segments on-the-fly + +Configuration +------------- + +Various prompt segments can be shown/hidden or modified according to your choice. There are two ways for doing that: + + +#. On-the-fly using ``atomic`` command +#. Theme Environment Variables + +On-the-fly using ``atomic`` command +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This theme provides a command for showing/hiding prompt segments. + +``atomic show `` + +``atomic hide `` + +Tab-completion for this command is enabled by default. + +Configuration specified by this command will only be applied to current and subsequent child shells. + +Theme Environment Variables +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This is used for permanent settings that apply to all terminal sessions. You have to define the value of specific theme variables in your ``bashrc`` (or equivalent) file. + +The name of the variables are listed below along with their default values. + +User Information +~~~~~~~~~~~~~~~~ + +Indicator for cached ``sudo`` credential (see ``sudo`` manpage for more information): + +``THEME_SHOW_SUDO=true`` + +SCM Information +~~~~~~~~~~~~~~~ + +Information about SCM repository status: + +``THEME_SHOW_SCM=true`` + +Ruby Environment +~~~~~~~~~~~~~~~~ + +Ruby environment version information: + +``THEME_SHOW_RUBY=false`` + +Python Environment +~~~~~~~~~~~~~~~~~~ + +Python environment version information: + +``THEME_SHOW_PYTHON=false`` + +ToDo.txt status +~~~~~~~~~~~~~~~ + +`Todo.txt `_ status: + +``THEME_SHOW_TODO=false`` + +Clock +~~~~~ + +``THEME_SHOW_CLOCK=true`` + +``THEME_CLOCK_COLOR=$bold_cyan`` + +Format of the clock (see ``date`` manpage for more information): + +``THEME_CLOCK_FORMAT="%H:%M:%S"`` + +Battery Charge +~~~~~~~~~~~~~~ + +Battery charge percentage: + +``THEME_SHOW_BATTERY=false`` + +Exit Code +~~~~~~~~~ + +Exit code of the last command: + +``THEME_SHOW_EXITCODE=true`` + +Prompt Segments Order +--------------------- + +Currently available prompt segments are: + + +* battery +* char +* clock +* dir +* exitcode +* python +* ruby +* scm +* todo +* user_info + +Three environment variables can be defined to rearrange the segments order. The default values are: + +``___ATOMIC_TOP_LEFT="user_info dir scm"`` + +``___ATOMIC_TOP_RIGHT="exitcode python ruby todo clock battery"`` + +``___ATOMIC_BOTTOM="char"`` + +Development by +^^^^^^^^^^^^^^ + +Developer / Author: `Luis Felipe Sánchez `_ + +This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. diff --git a/docs/themes-list/barbuk.rst b/docs/themes-list/barbuk.rst new file mode 100644 index 00000000..5fe49048 --- /dev/null +++ b/docs/themes-list/barbuk.rst @@ -0,0 +1,124 @@ +.. _barbuk: + +BarbUk theme +============ + +A minimal theme with a clean git prompt + +Provided Information +-------------------- + + +* Current git remote tool logo (support: github, gitlab, bitbucket) +* Current path (red when user is root) +* Current git info +* Last command exit code (only shown when the exit code is greater than 0) +* user@hostname for ssh connection + +Fonts and glyphs +---------------- + +A font with SCM glyphs is required to display the default tool/host logos. +You can use a font from https://www.nerdfonts.com/ or patch your own font with the tool +provided by https://github.com/ryanoasis/nerd-fonts. + +You can also override the default variables if you want to use different glyphs or standard ASCII characters. + +Default theme glyphs +^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: bash + + BARBUK_GITLAB_CHAR=' ' + BARBUK_BITBUCKET_CHAR=' ' + BARBUK_GITHUB_CHAR=' ' + BARBUK_GIT_DEFAULT_CHAR=' ' + BARBUK_GIT_BRANCH_ICON='' + BARBUK_HG_CHAR='☿ ' + BARBUK_SVN_CHAR='⑆ ' + BARBUK_EXIT_CODE_ICON=' ' + BARBUK_PYTHON_VENV_CHAR=' ' + +Customize glyphs +^^^^^^^^^^^^^^^^ + +Define your custom glyphs before sourcing bash-it: + +.. code-block:: bash + + export BARBUK_GITHUB_CHAR='•' + source "$BASH_IT"/bash_it.sh + +SSH prompt +---------- + +Usage +^^^^^ + +When using a ssh session, the theme will display ``user@hostname``. +You can disable this information with ``BARBUK_SSH_INFO``. + +The hostname is displayed in the FQDN format by default. You +can use the short hostname format with ``BARBUK_HOST_INFO``. + +.. code-block:: bash + + # short or long + export BARBUK_HOST_INFO=short + # true or false + export BARBUK_SSH_INFO=false + source "$BASH_IT"/bash_it.sh + +Keep theme with sudoer +^^^^^^^^^^^^^^^^^^^^^^ + +If you want the theme to persist using ``sudo -s`` in a ssh session, you need to configure sudo to keep the ``HOME`` and ``SSH_CONNECTION`` environment variables. + +``HOME`` contains the path to the home directory of the current user. Keeping it will allow to use your user dotfiles when elevating privileges. + +Keeping ``SSH_CONNECTION`` env is necessary for ssh detection in the theme. + +Please refer to the following documentation for more information: + + +* `sudo manual `_ for ``env_keep`` configuration +* `openssh manual `_ for information about ``SSH_CONNECTION`` environment + +.. code-block:: bash + + cat << EOF > /etc/sudoers.d/keepenv + Defaults env_keep += HOME + Defaults env_keep += SSH_CONNECTION + EOF + chmod 400 /etc/sudoers.d/keepenv + +Examples +-------- + +Clean +^^^^^ + +.. code-block:: bash + + ~ ❯ + +Git +^^^ + +.. code-block:: bash + +  ~/.dotfiles on  master ⤏ origin ↑2 •7 ✗ ❯ + +Ssh +^^^ + +.. code-block:: bash + + user@hostname in  ~/bash-it on  master ✓ ❯ + +Python venv +^^^^^^^^^^^ + +.. code-block:: bash + +   flask ~/test on  master ✓ ❯ diff --git a/docs/themes-list/bira.rst b/docs/themes-list/bira.rst new file mode 100644 index 00000000..ee69f712 --- /dev/null +++ b/docs/themes-list/bira.rst @@ -0,0 +1,12 @@ +.. _bira: + +Bira Theme +========== + +This is a port of Oh My Zsh's `'Bira' `_ theme. It looks the same as the original, except for the following changes: + + +* Exit code of last command is not shown +* More informative git prompt (if you want to keep it minimal, please read: :ref:`git_prompt`) +* Position and colour of virtualenv prompt +* No ruby version prompt diff --git a/docs/themes-list/brainy.rst b/docs/themes-list/brainy.rst new file mode 100644 index 00000000..04e1652a --- /dev/null +++ b/docs/themes-list/brainy.rst @@ -0,0 +1,145 @@ +.. _brainy: + +Brainy theme +============ + +Simple colorful terminal prompt theme (inspired by a number of themes). + +Features +-------- + +Prompt Segments +^^^^^^^^^^^^^^^ + + +* Username & Hostname +* Current Directory +* SCM Information +* Battery Charge +* Clock +* `Todo.txt `_ status +* Ruby Environment +* Python Environment +* Exit Code + +Others +^^^^^^ + + +* Indicator for cached ``sudo`` credential +* Indicator for ssh login +* ``brainy`` command for showing/hiding various prompt segments on-the-fly + +Configuration +------------- + +Various prompt segments can be shown/hidden or modified according to your choice. There are two ways for doing that: + + +#. On-the-fly using ``brainy`` command +#. Theme Environment Variables + +On-the-fly using ``brainy`` command +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This theme provides a command for showing/hiding prompt segments. + +``brainy show `` + +``brainy hide `` + +Tab-completion for this command is enabled by default. + +Configuration specified by this command will only be applied to current and subsequent child shells. + +Theme Environment Variables +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This is used for permanent settings that apply to all terminal sessions. You have to define the value of specific theme variables in your ``bashrc`` (or equivalent) file. + +The name of the variables are listed below along with their default values. + +User Information +~~~~~~~~~~~~~~~~ + +Indicator for cached ``sudo`` credential (see ``sudo`` manpage for more information): + +``THEME_SHOW_SUDO=true`` + +SCM Information +~~~~~~~~~~~~~~~ + +Information about SCM repository status: + +``THEME_SHOW_SCM=true`` + +Ruby Environment +~~~~~~~~~~~~~~~~ + +Ruby environment version information: + +``THEME_SHOW_RUBY=false`` + +Python Environment +~~~~~~~~~~~~~~~~~~ + +Python environment version information: + +``THEME_SHOW_PYTHON=false`` + +ToDo.txt status +~~~~~~~~~~~~~~~ + +`Todo.txt `_ status: + +``THEME_SHOW_TODO=false`` + +Clock +~~~~~ + +``THEME_SHOW_CLOCK=true`` + +``THEME_CLOCK_COLOR=$bold_cyan`` + +Format of the clock (see ``date`` manpage for more information): + +``THEME_CLOCK_FORMAT="%H:%M:%S"`` + +Battery Charge +~~~~~~~~~~~~~~ + +Battery charge percentage: + +``THEME_SHOW_BATTERY=false`` + +Exit Code +~~~~~~~~~ + +Exit code of the last command: + +``THEME_SHOW_EXITCODE=true`` + +Prompt Segments Order +--------------------- + +Currently available prompt segments are: + + +* battery +* char +* clock +* dir +* exitcode +* python +* ruby +* scm +* todo +* user_info + +Three environment variables can be defined to rearrange the segments order. The default values are: + +``___BRAINY_TOP_LEFT="user_info dir scm"`` + +``___BRAINY_TOP_RIGHT="python ruby todo clock battery"`` + +``___BRAINY_BOTTOM="exitcode char"`` diff --git a/docs/themes-list/codeword.rst b/docs/themes-list/codeword.rst new file mode 100644 index 00000000..00bb7ee4 --- /dev/null +++ b/docs/themes-list/codeword.rst @@ -0,0 +1,28 @@ +.. _codeword: + +Codeword Theme +============== + +Single line PS1 theme w/realtime history among windows. +Minimal theme overrides from bash_it base theming + +``user@host:path[virt-env][scm] $`` +--------------------------------------- + +Breakdown of the segments: + + +* **user@host:path** - *convienient for LAN based ``ssh`` and ``scp`` tasks* +* [\ **virtualenv**\ ] - *only appears when activated* +* [\ **scm**\ ] - *only appears when activated* +* **marker** - *$ or # depending on current user* + +Examples +^^^^^^^^ + +.. code-block:: bash + + user@example.lan:~ $ cd /tmp/foo/bar/baz + user@example.lan:/tmp/foo/bar/baz $ cd $HOME/workspace + user@example.lan:~/workspace $ cd sampleRepo/ + user@example.lan:~/workspace/sampleRepo [± |master ↑1 ↓3 {1} S:2 ?:1 ✗|] $ diff --git a/docs/themes-list/index.rst b/docs/themes-list/index.rst index e15cd313..6e912446 100644 --- a/docs/themes-list/index.rst +++ b/docs/themes-list/index.rst @@ -3,10 +3,20 @@ List of Themes ============== -Below is a list of most of the themes (with screenshots) that `bash-it `_ ships with. +Below is a list of most of the themes (with screenshots) and their documentation that `bash-it `_ ships with. -Alphabetical List: ------------------- +.. note:: + Not all themes have documentation! + +.. toctree:: + :maxdepth: 1 + :caption: Documentation of Themes + :glob: + + * + +Alphabetical Screenshots List +----------------------------- Bakke ^^^^^ @@ -304,6 +314,8 @@ n0Qorg ---- +.. _nwinkler_image: + NWinkler ^^^^^^^^ diff --git a/themes/nwinkler_random_colors/screenshot.png b/docs/themes-list/nwinkler_random_colors.png similarity index 100% rename from themes/nwinkler_random_colors/screenshot.png rename to docs/themes-list/nwinkler_random_colors.png diff --git a/docs/themes-list/nwinkler_random_colors.rst b/docs/themes-list/nwinkler_random_colors.rst new file mode 100644 index 00000000..20ea34c3 --- /dev/null +++ b/docs/themes-list/nwinkler_random_colors.rst @@ -0,0 +1,39 @@ +.. _nwinkler_random_color: + +Nwinkler Random Color Theme +=========================== + +Description +----------- + +The *Nwinkler Random Color* Theme is based on the :ref:`Nwinkler Theme ` , but it randomizes the colors for: + + +* time +* username +* hostname +* path + +The random colors are chosen the first time this theme is used and saved to the ``~/.nwinkler_random_colors`` file. So, the next time you connect to the same machine, you will get the same colors. + +To force new random colors to be selected, run the command: + +.. code-block:: sh + + randomize_nwinkler + +Screenshot +---------- + +Here it is in action: + + +.. image:: nwinkler_random_colors.png + :target: nwinkler_random_colors.png + :alt: alt text + + +Usage Scenario +-------------- + +This theme is especially useful when connecting to many different machines and switching between them often. Yes, the hostname *is* present in the prompt. But I argue that it's a lot faster to get a "feel" of what machine you are currently on because of the custom colors on that machine's prompt than by reading the hostname. diff --git a/docs/themes-list/powerline-multiline.rst b/docs/themes-list/powerline-multiline.rst new file mode 100644 index 00000000..41cf0cf6 --- /dev/null +++ b/docs/themes-list/powerline-multiline.rst @@ -0,0 +1,144 @@ +.. _powerline_multiline: + +Powerline Multiline Theme +========================= + +A colorful multiline theme, where the first line shows information about your shell session (divided into two parts, left and right), and the second one is where the shell commands are introduced. + +**IMPORTANT:** This theme requires that `a font with the Powerline symbols `_ needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator. + +Provided Information +-------------------- + + +* Current path +* Current username and hostname +* Current time +* Current shell level +* Current dirstack level (\ ``pushd`` / ``popd``\ ) +* Current history number +* Current command number +* An indicator when connected by SSH +* An indicator when ``sudo`` has the credentials cached (see the ``sudo`` manpage for more info about this) +* An indicator when the current shell is inside the Vim editor +* Battery charging status (depends on the battery plugin) +* SCM Repository status (e.g. Git, SVN) +* The current Python environment (Virtualenv, venv, and Conda are supported) in use +* The current Ruby environment (rvm and rbenv are supported) in use +* Last command exit code (only shown when the exit code is greater than 0) + +Configuration +------------- + +This theme is pretty configurable, all the configuration is done by setting environment variables. + +User Information +^^^^^^^^^^^^^^^^ + +By default, the username and hostname are shown on the right hand side, but you can change this behavior by setting the value of the following variable: + +.. code-block:: bash + + export POWERLINE_PROMPT_USER_INFO_MODE="sudo" + +For now, the only supported value is ``sudo``\ , which hides the username and hostname, and shows an indicator when ``sudo`` has the credentials cached. Other values have no effect at this time. + +Clock Format +^^^^^^^^^^^^ + +By default, the current time is shown on the right hand side, you can change the format using the following variable: + +.. code-block:: bash + + export THEME_CLOCK_FORMAT="%H:%M:%S" + +The time/date is printed by the ``date`` command, so refer to its man page to change the format. + +Soft Separators +^^^^^^^^^^^^^^^ + +Adjacent segments having the same background color will use a less-pronouced (i.e. soft) separator between them. + +Segment Order +^^^^^^^^^^^^^ + +The contents of both prompt sides can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: + + +* ``aws_profile`` - Show the current value of the ``AWS_PROFILE`` environment variable +* ``battery`` - Battery information (you'll need to enable the ``battery`` plugin) +* ``clock`` - Current time in ``HH:MM:SS`` format +* ``cwd`` - Current working directory including full folder hierarchy (c.f. ``wd``\ ) +* ``hostname`` - Host name of machine +* ``in_vim`` - Show identifier if running in ``:terminal`` from vim +* ``k8s_context`` - Show current kubernetes context +* ``last_status`` - Exit status of last run command +* ``python_venv`` - Python virtual environment information (\ ``virtualenv``\ , ``venv`` + and ``conda`` supported) +* ``ruby`` - Current ruby version if using ``rvm`` +* ``node`` - Current node version (only ``nvm`` is supported) +* ``scm`` - Version control information, ``git`` +* ``terraform`` - Current terraform workspace +* ``user_info`` - Current user +* ``wd`` - Working directory, like ``cwd`` but doesn't show the full folder + hierarchy, only the directory you're currently in. +* ``shlvl`` - Show the current shell level (based on ``SHLVL`` environment variable), but only if you are not in root shell +* ``dirstack`` - Show the current dirstack level (based on ``DIRSTACK`` environment variable), but only if the stack is not empty +* ``history_number`` - Show current history number +* ``command_number`` - Show current command number + +Two variables can be defined to set the order of the prompt segments: + +.. code-block:: bash + + export POWERLINE_LEFT_PROMPT="scm python_venv ruby cwd" + export POWERLINE_RIGHT_PROMPT="in_vim clock battery user_info" + +The example values above are the current default values, but if you want to remove anything from the prompt, simply remove the "string" that represents the segment from the corresponding variable. + +Padding +^^^^^^^ + +To get the length of the left and right segments right, a *padding* value is used. +In most cases, the default value (\ *2*\ ) works fine, but on some operating systems, this needs to be adjusted. +One example is *macOS High Sierra*\ , where the default padding causes the right segment to extend to the next line. +On macOS High Sierra, the padding value needs to be changed to *3* to make the theme look right. +This can be done by setting the ``POWERLINE_PADDING`` variable before Bash-it is loaded, e.g. in your ``~/.bash_profile`` or ``~/.bashrc`` file: + +.. code-block:: bash + + export POWERLINE_PADDING=3 + +Compact Settings +^^^^^^^^^^^^^^^^ + +You can configure various aspects of the prompt to use less whitespace. Supported variables are: + +.. list-table:: + :header-rows: 1 + + * - Variable + - Description + * - POWERLINE_COMPACT_BEFORE_SEPARATOR + - Removes the leading space before each separator + * - POWERLINE_COMPACT_AFTER_SEPARATOR + - Removes the trailing space after each separator + * - POWERLINE_COMPACT_BEFOR_FIRST_SEGMENT + - Removes the leading space on the first segment + * - POWERLINE_COMPACT_AFTER_LAST_SEGMENT + - Removes the trailing space on the last segment + * - POWERLINE_COMPACT_PROMPT + - Removes the space after the prompt character + * - POWERLINE_COMPACT + - Enable all Compact settings (you can still override individual settings) + + +The default value for all settings is ``0`` (disabled). Use ``1`` to enable. + +**Multiline Mode Right Prompt** + +For the purposes of the ``Compact`` settings, the segments within the **Right Prompt** are considered to run "right-to-left", i.e.: + + +* The **right-most** segment is considered to be the ``"first"`` segment, while the **left-most** segment is considered to be the ``"last"`` +* The space to the **right** of the separator character is considered to be ``"before"``\ , while the space to the **left** is considered to be ``"after"`` diff --git a/docs/themes-list/powerline-naked.rst b/docs/themes-list/powerline-naked.rst new file mode 100644 index 00000000..3a4e07d4 --- /dev/null +++ b/docs/themes-list/powerline-naked.rst @@ -0,0 +1,121 @@ +.. _powerline_naked: + +Powerline Naked Theme +===================== + +A colorful theme, where shows a lot information about your shell session. + +**IMPORTANT:** This theme requires that `a font with the Powerline symbols `_ needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator. + +Provided Information +-------------------- + + +* Current path +* Current username and hostname +* Current time +* Current shell level +* Current dirstack level (\ ``pushd`` / ``popd``\ ) +* Current history number +* Current command number +* An indicator when connected by SSH +* An indicator when ``sudo`` has the credentials cached (see the ``sudo`` manpage for more info about this) +* An indicator when the current shell is inside the Vim editor +* Battery charging status (depends on the battery plugin) +* SCM Repository status (e.g. Git, SVN) +* The current Kubernetes environment +* The current Python environment (Virtualenv, venv, and Conda are supported) in use +* The current Ruby environment (rvm and rbenv are supported) in use +* Last command exit code (only shown when the exit code is greater than 0) + +Configuration +------------- + +This theme is pretty configurable, all the configuration is done by setting environment variables. + +User Information +^^^^^^^^^^^^^^^^ + +By default, the username and hostname are shown, but you can change this behavior by setting the value of the following variable: + +.. code-block:: + + POWERLINE_PROMPT_USER_INFO_MODE="sudo" + + +For now, the only supported value is ``sudo``\ , which hides the username and hostname, and shows an indicator when ``sudo`` has the credentials cached. Other values have no effect at this time. + +Clock Format +^^^^^^^^^^^^ + +You can change the format using the following variable: + +.. code-block:: + + THEME_CLOCK_FORMAT="%H:%M:%S" + + +The time/date is printed by the ``date`` command, so refer to its man page to change the format. + +Segment Order +^^^^^^^^^^^^^ + +The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: + + +* ``aws_profile`` - Show the current value of the ``AWS_PROFILE`` environment variable +* ``battery`` - Battery information (you'll need to enable the ``battery`` plugin) +* ``clock`` - Current time in ``HH:MM:SS`` format +* ``cwd`` - Current working directory including full folder hierarchy (c.f. ``wd``\ ) +* ``hostname`` - Host name of machine +* ``in_vim`` - Show identifier if running in ``:terminal`` from vim +* ``k8s_context`` - Show current kubernetes context +* ``last_status`` - Exit status of last run command +* ``python_venv`` - Python virtual environment information (\ ``virtualenv``\ , ``venv`` + and ``conda`` supported) +* ``ruby`` - Current ruby version if using ``rvm`` +* ``node`` - Current node version (only ``nvm`` is supported) +* ``scm`` - Version control information, ``git`` +* ``terraform`` - Current terraform workspace +* ``user_info`` - Current user +* ``wd`` - Working directory, like ``cwd`` but doesn't show the full folder + hierarchy, only the directory you're currently in. +* ``shlvl`` - Show the current shell level (based on ``SHLVL`` environment variable), but only if you are not in root shell +* ``dirstack`` - Show the current dirstack level (based on ``DIRSTACK`` environment variable), but only if the stack is not empty +* ``history_number`` - Show current history number +* ``command_number`` - Show current command number + +A variable can be defined to set the order of the prompt segments: + +.. code-block:: + + POWERLINE_PROMPT="user_info scm python_venv ruby cwd" + + +The example values above are the current default values, but if you want to remove anything from the prompt, simply remove the "string" that represents the segment from the variable. + +Compact Settings +^^^^^^^^^^^^^^^^ + +You can configure various aspects of the prompt to use less whitespace. Supported variables are: + +.. list-table:: + :header-rows: 1 + + * - Variable + - Description + * - POWERLINE_COMPACT_BEFORE_SEPARATOR + - Removes the leading space before each separator + * - POWERLINE_COMPACT_AFTER_SEPARATOR + - Removes the trailing space after each separator + * - POWERLINE_COMPACT_BEFOR_FIRST_SEGMENT + - Removes the leading space on the first segment + * - POWERLINE_COMPACT_AFTER_LAST_SEGMENT + - Removes the trailing space on the last segment + * - POWERLINE_COMPACT_PROMPT + - Removes the space after the prompt character + * - POWERLINE_COMPACT + - Enable all Compact settings (you can still override individual settings) + + +The default value for all settings is ``0`` (disabled). Use ``1`` to enable. diff --git a/docs/themes-list/powerline-plain.rst b/docs/themes-list/powerline-plain.rst new file mode 100644 index 00000000..ae575f57 --- /dev/null +++ b/docs/themes-list/powerline-plain.rst @@ -0,0 +1,121 @@ +.. _powerline_plain: + +Powerline Plain Theme +===================== + +A colorful theme, where shows a lot information about your shell session. + +Provided Information +-------------------- + + +* Current path +* Current username and hostname +* Current time +* Current shell level +* Current dirstack level (\ ``pushd`` / ``popd``\ ) +* Current history number +* Current command number +* An indicator when connected by SSH +* An indicator when ``sudo`` has the credentials cached (see the ``sudo`` manpage for more info about this) +* An indicator when the current shell is inside the Vim editor +* Battery charging status (depends on the battery plugin) +* SCM Repository status (e.g. Git, SVN) +* The current Kubernetes environment +* The current Python environment (Virtualenv, venv, and Conda are supported) in use +* The current Ruby environment (rvm and rbenv are supported) in use +* Last command exit code (only shown when the exit code is greater than 0) + +Configuration +------------- + +This theme is pretty configurable, all the configuration is done by setting environment variables. + +User Information +^^^^^^^^^^^^^^^^ + +By default, the username and hostname are shown, but you can change this behavior by setting the value of the following variable: + +.. code-block:: + + POWERLINE_PROMPT_USER_INFO_MODE="sudo" + + +For now, the only supported value is ``sudo``\ , which hides the username and hostname, and shows an indicator when ``sudo`` has the credentials cached. Other values have no effect at this time. + +Clock Format +^^^^^^^^^^^^ + +You can change the format using the following variable: + +.. code-block:: + + THEME_CLOCK_FORMAT="%H:%M:%S" + + +The time/date is printed by the ``date`` command, so refer to its man page to change the format. + +Segment Order +^^^^^^^^^^^^^ + +The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: + + +* ``aws_profile`` - Show the current value of the ``AWS_PROFILE`` environment variable +* ``battery`` - Battery information (you'll need to enable the ``battery`` plugin) +* ``clock`` - Current time in ``HH:MM:SS`` format +* ``cwd`` - Current working directory including full folder hierarchy (c.f. ``wd``\ ) +* ``hostname`` - Host name of machine +* ``in_vim`` - Show identifier if running in ``:terminal`` from vim +* ``k8s_context`` - Show current kubernetes context +* ``last_status`` - Exit status of last run command +* ``python_venv`` - Python virtual environment information (\ ``virtualenv``\ , ``venv`` + and ``conda`` supported) +* ``ruby`` - Current ruby version if using ``rvm`` +* ``node`` - Current node version (only ``nvm`` is supported) +* ``scm`` - Version control information, ``git`` +* ``terraform`` - Current terraform workspace +* ``user_info`` - Current user +* ``wd`` - Working directory, like ``cwd`` but doesn't show the full folder + hierarchy, only the directory you're currently in. +* ``shlvl`` - Show the current shell level (based on ``SHLVL`` environment variable), but only if you are not in root shell +* ``dirstack`` - Show the current dirstack level (based on ``DIRSTACK`` environment variable), but only if the stack is not empty +* ``history_number`` - Show current history number +* ``command_number`` - Show current command number + +A variable can be defined to set the order of the prompt segments: + +.. code-block:: + + POWERLINE_PROMPT="user_info scm python_venv ruby cwd" + + +The example values above are the current default values, but if you want to remove anything from the prompt, simply remove the "string" that represents the segment from the variable. + +Compact Settings +^^^^^^^^^^^^^^^^ + +You can configure various aspects of the prompt to use less whitespace. Supported variables are: + +.. list-table:: + :header-rows: 1 + + * - Variable + - Description + * - POWERLINE_COMPACT_BEFORE_SEPARATOR + - Removes the leading space before each separator + * - POWERLINE_COMPACT_AFTER_SEPARATOR + - Removes the trailing space after each separator + * - POWERLINE_COMPACT_BEFOR_FIRST_SEGMENT + - Removes the leading space on the first segment + * - POWERLINE_COMPACT_AFTER_LAST_SEGMENT + - Removes the trailing space on the last segment + * - POWERLINE_COMPACT_PROMPT + - Removes the space after the prompt character + * - POWERLINE_COMPACT + - Enable all Compact settings (you can still override individual settings) + * - POWERLINE_PROMPT_AFTER + - Adds characters after the prompt + + +The default value for all settings is ``0`` (disabled). Use ``1`` to enable. diff --git a/docs/themes-list/powerline.rst b/docs/themes-list/powerline.rst new file mode 100644 index 00000000..7afd866d --- /dev/null +++ b/docs/themes-list/powerline.rst @@ -0,0 +1,128 @@ +.. _powerline: + +Powerline Theme +=============== + +A colorful theme, where shows a lot information about your shell session. + +**IMPORTANT:** This theme requires that `a font with the Powerline symbols `_ needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator. + +**NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If that is not the case (e.g. if you are running on a corporate network where ``sudo`` usage is tracked), you can set the flag 'export THEME_CHECK_SUDO=false' in your ``~/.bashrc`` or ``~/.bash_profile`` to disable the Powerline theme's ``sudo`` check. This will apply to all ``powerline*`` themes. + +Provided Information +-------------------- + + +* Current path +* Current username and hostname +* Current time +* Current shell level +* Current dirstack level (\ ``pushd`` / ``popd``\ ) +* Current history number +* Current command number +* An indicator when connected by SSH +* An indicator when ``sudo`` has the credentials cached (see the ``sudo`` manpage for more info about this) +* An indicator when the current shell is inside the Vim editor +* Battery charging status (depends on the battery plugin) +* SCM Repository status (e.g. Git, SVN) +* The current Kubernetes environment +* The current Python environment (Virtualenv, venv, and Conda are supported) in use +* The current Ruby environment (rvm and rbenv are supported) in use +* Last command exit code (only shown when the exit code is greater than 0) + +Configuration +------------- + +This theme is pretty configurable, all the configuration is done by setting environment variables. + +User Information +^^^^^^^^^^^^^^^^ + +By default, the username and hostname are shown, but you can change this behavior by setting the value of the following variable: + +.. code-block:: bash + + export POWERLINE_PROMPT_USER_INFO_MODE="sudo" + + +For now, the only supported value is ``sudo``\ , which hides the username and hostname, and shows an indicator when ``sudo`` has the credentials cached. Other values have no effect at this time. + +Clock Format +^^^^^^^^^^^^ + +You can change the format using the following variable: + +.. code-block:: bash + + export THEME_CLOCK_FORMAT="%H:%M:%S" + + +The time/date is printed by the ``date`` command, so refer to its man page to change the format. + +Soft Separators +^^^^^^^^^^^^^^^ + +Adjacent segments having the same background color will use a less-pronouced (i.e. soft) separator between them. + +Segment Order +^^^^^^^^^^^^^ + +The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: + + +* ``aws_profile`` - Show the current value of the ``AWS_PROFILE`` environment variable +* ``battery`` - Battery information (you'll need to enable the ``battery`` plugin) +* ``clock`` - Current time in ``HH:MM:SS`` format +* ``cwd`` - Current working directory including full folder hierarchy (c.f. ``wd``\ ) +* ``hostname`` - Host name of machine +* ``in_vim`` - Show identifier if running in ``:terminal`` from vim +* ``k8s_context`` - Show current kubernetes context +* ``last_status`` - Exit status of last run command +* ``python_venv`` - Python virtual environment information (\ ``virtualenv``\ , ``venv`` + and ``conda`` supported) +* ``ruby`` - Current ruby version if using ``rvm`` +* ``node`` - Current node version (only ``nvm`` is supported) +* ``scm`` - Version control information, ``git`` +* ``terraform`` - Current terraform workspace +* ``user_info`` - Current user +* ``wd`` - Working directory, like ``cwd`` but doesn't show the full folder + hierarchy, only the directory you're currently in. +* ``shlvl`` - Show the current shell level (based on ``SHLVL`` environment variable), but only if you are not in root shell +* ``dirstack`` - Show the current dirstack level (based on ``DIRSTACK`` environment variable), but only if the stack is not empty +* ``history_number`` - Show current history number +* ``command_number`` - Show current command number + +A variable can be defined to set the order of the prompt segments: + +.. code-block:: + + POWERLINE_PROMPT="user_info scm python_venv ruby cwd" + + +The example values above are the current default values, but if you want to remove anything from the prompt, simply remove the "string" that represents the segment from the variable. + +Compact Settings +^^^^^^^^^^^^^^^^ + +You can configure various aspects of the prompt to use less whitespace. Supported variables are: + +.. list-table:: + :header-rows: 1 + + * - Variable + - Description + * - POWERLINE_COMPACT_BEFORE_SEPARATOR + - Removes the leading space before each separator + * - POWERLINE_COMPACT_AFTER_SEPARATOR + - Removes the trailing space after each separator + * - POWERLINE_COMPACT_BEFOR_FIRST_SEGMENT + - Removes the leading space on the first segment + * - POWERLINE_COMPACT_AFTER_LAST_SEGMENT + - Removes the trailing space on the last segment + * - POWERLINE_COMPACT_PROMPT + - Removes the space after the prompt character + * - POWERLINE_COMPACT + - Enable all Compact settings (you can still override individual settings) + + +The default value for all settings is ``0`` (disabled). Use ``1`` to enable. diff --git a/docs/themes-list/radek.rst b/docs/themes-list/radek.rst new file mode 100644 index 00000000..333999cc --- /dev/null +++ b/docs/themes-list/radek.rst @@ -0,0 +1,25 @@ +.. _radek: + +Radek Theme +=========== + +A colorful theme for Python developers. +It does not have any requirements. + +Provided Information +-------------------- + + +* Current username and hostname +* Current path +* Git repository status +* Current Python environment (venv, Conda ) +* Current Python version + +Examples +-------- + +.. code-block:: bash + + [radek@photon][~/src/nokia2/cbis] ±[master → origin ↑1 {1}✓][venv-cbis][py-3.7.5] + → diff --git a/themes/redline/screenshot.png b/docs/themes-list/redline.png similarity index 100% rename from themes/redline/screenshot.png rename to docs/themes-list/redline.png diff --git a/docs/themes-list/redline.rst b/docs/themes-list/redline.rst new file mode 100644 index 00000000..ba5abcf4 --- /dev/null +++ b/docs/themes-list/redline.rst @@ -0,0 +1,56 @@ +.. _redline: + +Redline Theme +============= + +changed up the powerline base a little. + +It plays nicest with this font: `DroidSansMonoForPowerline `_ + +Read the :ref:`powerline theme documentation ` + +added +----- + + +* hostname +* distro logo + +changed +------- + + +* sudo credential check +* required font +* some icons + +Works real good like with: + +.. code-block:: bash + + ## set the theme + export BASH_IT_THEME='redline' + + # Set this to false to turn off version control status checking within the prompt for all themes + export SCM_CHECK=true + + ## Set Xterm/screen/Tmux title with only a short hostname. + export SHORT_HOSTNAME=$(hostname -s) + + ## enable sudo prompt + export POWERLINE_PROMPT_USER_INFO_MODE="sudo" + + ## prompt part string + export POWERLINE_PROMPT="python_venv user_info hostname cwd scm" + +enable your distro logo with +---------------------------- + +.. code-block:: bash + + export POWERLINE_PROMPT_DISTRO_LOGO="yes" + + +.. image:: redline.png + :target: redline.png?raw=true + :alt: screenshot From d3d9a79f1ead47619756bd83719f2ef66e6268e1 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Fri, 30 Oct 2020 19:13:41 +0200 Subject: [PATCH 63/68] docs: Update contributing theme guidelines --- docs/contributing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/contributing.rst b/docs/contributing.rst index 9964e03c..98c37761 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -105,5 +105,5 @@ 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. - The project's Wiki has a *Themes* page where you can add a screenshot if you want. -* Ideally, each theme's folder should contain a ``README.md`` file describing the theme and its configuration options. + The project's docs has a `Themes page `_ where you can add a screenshot if you want (by link). +* Ideally, you should add a ``.rst`` file describing the theme and its configuration options to ``docs/themes-list`` folder. From 60c8b4be9f485f0df3728e53c383cc0df6dfbc73 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Fri, 4 Dec 2020 17:22:51 +0200 Subject: [PATCH 64/68] docs: Move powerline theme docs into powerline-base.rst --- docs/themes-list/powerline-base.rst | 127 +++++++++++++++++++++++ docs/themes-list/powerline-multiline.rst | 116 +-------------------- docs/themes-list/powerline-naked.rst | 116 +-------------------- docs/themes-list/powerline-plain.rst | 117 +-------------------- docs/themes-list/powerline.rst | 117 +-------------------- 5 files changed, 139 insertions(+), 454 deletions(-) create mode 100644 docs/themes-list/powerline-base.rst diff --git a/docs/themes-list/powerline-base.rst b/docs/themes-list/powerline-base.rst new file mode 100644 index 00000000..d0f6ab30 --- /dev/null +++ b/docs/themes-list/powerline-base.rst @@ -0,0 +1,127 @@ +.. _powerline_base: + +Base Powerline Theme Information +================================ + +This page explains base powerline theme information, shared between +all powerline themes. + +**IMPORTANT:** This theme requires that `a font with the Powerline symbols `_ needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator. + +**NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If that is not the case (e.g. if you are running on a corporate network where ``sudo`` usage is tracked), you can set the flag 'export THEME_CHECK_SUDO=false' in your ``~/.bashrc`` or ``~/.bash_profile`` to disable the Powerline theme's ``sudo`` check. This will apply to all ``powerline*`` themes. + +Provided Information +-------------------- + + +* Current path +* Current username and hostname +* Current time +* Current shell level +* Current dirstack level (\ ``pushd`` / ``popd``\ ) +* Current history number +* Current command number +* An indicator when connected by SSH +* An indicator when ``sudo`` has the credentials cached (see the ``sudo`` manpage for more info about this) +* An indicator when the current shell is inside the Vim editor +* Battery charging status (depends on the battery plugin) +* SCM Repository status (e.g. Git, SVN) +* The current Kubernetes environment +* The current Python environment (Virtualenv, venv, and Conda are supported) in use +* The current Ruby environment (rvm and rbenv are supported) in use +* Last command exit code (only shown when the exit code is greater than 0) + +Configuration +------------- + +This theme is pretty configurable, all the configuration is done by setting environment variables. + +User Information +^^^^^^^^^^^^^^^^ + +By default, the username and hostname are shown, but you can change this behavior by setting the value of the following variable: + +.. code-block:: bash + + export POWERLINE_PROMPT_USER_INFO_MODE="sudo" + + +For now, the only supported value is ``sudo``\ , which hides the username and hostname, and shows an indicator when ``sudo`` has the credentials cached. Other values have no effect at this time. + +Clock Format +^^^^^^^^^^^^ + +You can change the format using the following variable: + +.. code-block:: bash + + export THEME_CLOCK_FORMAT="%H:%M:%S" + + +The time/date is printed by the ``date`` command, so refer to its man page to change the format. + +Segment Order +^^^^^^^^^^^^^ + +The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: + + +* ``aws_profile`` - Show the current value of the ``AWS_PROFILE`` environment variable +* ``battery`` - Battery information (you'll need to enable the ``battery`` plugin) +* ``clock`` - Current time in ``HH:MM:SS`` format +* ``cwd`` - Current working directory including full folder hierarchy (c.f. ``wd``\ ) +* ``hostname`` - Host name of machine +* ``in_toolbox`` - Show identifier if running inside a `toolbox `_ +* ``in_vim`` - Show identifier if running in ``:terminal`` from vim +* ``k8s_context`` - Show current kubernetes context +* ``last_status`` - Exit status of last run command +* ``python_venv`` - Python virtual environment information (\ ``virtualenv``\ , ``venv`` + and ``conda`` supported) +* ``ruby`` - Current ruby version if using ``rvm`` +* ``node`` - Current node version (only ``nvm`` is supported) +* ``scm`` - Version control information, ``git`` +* ``terraform`` - Current terraform workspace +* ``user_info`` - Current user +* ``wd`` - Working directory, like ``cwd`` but doesn't show the full folder + hierarchy, only the directory you're currently in. +* ``shlvl`` - Show the current shell level (based on ``SHLVL`` environment variable), but only if you are not in root shell +* ``dirstack`` - Show the current dirstack level (based on ``DIRSTACK`` environment variable), but only if the stack is not empty +* ``history_number`` - Show current history number +* ``command_number`` - Show current command number + +A variable can be defined to set the order of the prompt segments: + +.. code-block:: + + POWERLINE_PROMPT="user_info scm python_venv ruby cwd" + + +The example values above are the current default values, but if you want to remove anything from the prompt, simply remove the "string" that represents the segment from the variable. + +.. _powerline_compact_settings: + +Compact Settings +^^^^^^^^^^^^^^^^ + +You can configure various aspects of the prompt to use less whitespace. Supported variables are: + +.. list-table:: + :header-rows: 1 + + * - Variable + - Description + * - POWERLINE_COMPACT_BEFORE_SEPARATOR + - Removes the leading space before each separator + * - POWERLINE_COMPACT_AFTER_SEPARATOR + - Removes the trailing space after each separator + * - POWERLINE_COMPACT_BEFOR_FIRST_SEGMENT + - Removes the leading space on the first segment + * - POWERLINE_COMPACT_AFTER_LAST_SEGMENT + - Removes the trailing space on the last segment + * - POWERLINE_COMPACT_PROMPT + - Removes the space after the prompt character + * - POWERLINE_COMPACT + - Enable all Compact settings (you can still override individual settings) + + +The default value for all settings is ``0`` (disabled). Use ``1`` to enable. diff --git a/docs/themes-list/powerline-multiline.rst b/docs/themes-list/powerline-multiline.rst index 41cf0cf6..f525f022 100644 --- a/docs/themes-list/powerline-multiline.rst +++ b/docs/themes-list/powerline-multiline.rst @@ -5,97 +5,13 @@ Powerline Multiline Theme A colorful multiline theme, where the first line shows information about your shell session (divided into two parts, left and right), and the second one is where the shell commands are introduced. -**IMPORTANT:** This theme requires that `a font with the Powerline symbols `_ needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator. - -Provided Information --------------------- - - -* Current path -* Current username and hostname -* Current time -* Current shell level -* Current dirstack level (\ ``pushd`` / ``popd``\ ) -* Current history number -* Current command number -* An indicator when connected by SSH -* An indicator when ``sudo`` has the credentials cached (see the ``sudo`` manpage for more info about this) -* An indicator when the current shell is inside the Vim editor -* Battery charging status (depends on the battery plugin) -* SCM Repository status (e.g. Git, SVN) -* The current Python environment (Virtualenv, venv, and Conda are supported) in use -* The current Ruby environment (rvm and rbenv are supported) in use -* Last command exit code (only shown when the exit code is greater than 0) - -Configuration -------------- - -This theme is pretty configurable, all the configuration is done by setting environment variables. - -User Information -^^^^^^^^^^^^^^^^ - -By default, the username and hostname are shown on the right hand side, but you can change this behavior by setting the value of the following variable: - -.. code-block:: bash - - export POWERLINE_PROMPT_USER_INFO_MODE="sudo" - -For now, the only supported value is ``sudo``\ , which hides the username and hostname, and shows an indicator when ``sudo`` has the credentials cached. Other values have no effect at this time. - -Clock Format -^^^^^^^^^^^^ - -By default, the current time is shown on the right hand side, you can change the format using the following variable: - -.. code-block:: bash - - export THEME_CLOCK_FORMAT="%H:%M:%S" - -The time/date is printed by the ``date`` command, so refer to its man page to change the format. +See :ref:`powerline_base` for general information about the powerline theme. Soft Separators ^^^^^^^^^^^^^^^ Adjacent segments having the same background color will use a less-pronouced (i.e. soft) separator between them. -Segment Order -^^^^^^^^^^^^^ - -The contents of both prompt sides can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: - - -* ``aws_profile`` - Show the current value of the ``AWS_PROFILE`` environment variable -* ``battery`` - Battery information (you'll need to enable the ``battery`` plugin) -* ``clock`` - Current time in ``HH:MM:SS`` format -* ``cwd`` - Current working directory including full folder hierarchy (c.f. ``wd``\ ) -* ``hostname`` - Host name of machine -* ``in_vim`` - Show identifier if running in ``:terminal`` from vim -* ``k8s_context`` - Show current kubernetes context -* ``last_status`` - Exit status of last run command -* ``python_venv`` - Python virtual environment information (\ ``virtualenv``\ , ``venv`` - and ``conda`` supported) -* ``ruby`` - Current ruby version if using ``rvm`` -* ``node`` - Current node version (only ``nvm`` is supported) -* ``scm`` - Version control information, ``git`` -* ``terraform`` - Current terraform workspace -* ``user_info`` - Current user -* ``wd`` - Working directory, like ``cwd`` but doesn't show the full folder - hierarchy, only the directory you're currently in. -* ``shlvl`` - Show the current shell level (based on ``SHLVL`` environment variable), but only if you are not in root shell -* ``dirstack`` - Show the current dirstack level (based on ``DIRSTACK`` environment variable), but only if the stack is not empty -* ``history_number`` - Show current history number -* ``command_number`` - Show current command number - -Two variables can be defined to set the order of the prompt segments: - -.. code-block:: bash - - export POWERLINE_LEFT_PROMPT="scm python_venv ruby cwd" - export POWERLINE_RIGHT_PROMPT="in_vim clock battery user_info" - -The example values above are the current default values, but if you want to remove anything from the prompt, simply remove the "string" that represents the segment from the corresponding variable. - Padding ^^^^^^^ @@ -109,35 +25,11 @@ This can be done by setting the ``POWERLINE_PADDING`` variable before Bash-it is export POWERLINE_PADDING=3 -Compact Settings -^^^^^^^^^^^^^^^^ -You can configure various aspects of the prompt to use less whitespace. Supported variables are: +Multiline Mode Right Prompt +^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. list-table:: - :header-rows: 1 - - * - Variable - - Description - * - POWERLINE_COMPACT_BEFORE_SEPARATOR - - Removes the leading space before each separator - * - POWERLINE_COMPACT_AFTER_SEPARATOR - - Removes the trailing space after each separator - * - POWERLINE_COMPACT_BEFOR_FIRST_SEGMENT - - Removes the leading space on the first segment - * - POWERLINE_COMPACT_AFTER_LAST_SEGMENT - - Removes the trailing space on the last segment - * - POWERLINE_COMPACT_PROMPT - - Removes the space after the prompt character - * - POWERLINE_COMPACT - - Enable all Compact settings (you can still override individual settings) - - -The default value for all settings is ``0`` (disabled). Use ``1`` to enable. - -**Multiline Mode Right Prompt** - -For the purposes of the ``Compact`` settings, the segments within the **Right Prompt** are considered to run "right-to-left", i.e.: +For the purposes of the :ref:`Compact ` settings, the segments within the **Right Prompt** are considered to run "right-to-left", i.e.: * The **right-most** segment is considered to be the ``"first"`` segment, while the **left-most** segment is considered to be the ``"last"`` diff --git a/docs/themes-list/powerline-naked.rst b/docs/themes-list/powerline-naked.rst index 3a4e07d4..cf4b0869 100644 --- a/docs/themes-list/powerline-naked.rst +++ b/docs/themes-list/powerline-naked.rst @@ -4,118 +4,6 @@ Powerline Naked Theme ===================== A colorful theme, where shows a lot information about your shell session. +The naked powerline theme provides a cleaner shell with less background colors. -**IMPORTANT:** This theme requires that `a font with the Powerline symbols `_ needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator. - -Provided Information --------------------- - - -* Current path -* Current username and hostname -* Current time -* Current shell level -* Current dirstack level (\ ``pushd`` / ``popd``\ ) -* Current history number -* Current command number -* An indicator when connected by SSH -* An indicator when ``sudo`` has the credentials cached (see the ``sudo`` manpage for more info about this) -* An indicator when the current shell is inside the Vim editor -* Battery charging status (depends on the battery plugin) -* SCM Repository status (e.g. Git, SVN) -* The current Kubernetes environment -* The current Python environment (Virtualenv, venv, and Conda are supported) in use -* The current Ruby environment (rvm and rbenv are supported) in use -* Last command exit code (only shown when the exit code is greater than 0) - -Configuration -------------- - -This theme is pretty configurable, all the configuration is done by setting environment variables. - -User Information -^^^^^^^^^^^^^^^^ - -By default, the username and hostname are shown, but you can change this behavior by setting the value of the following variable: - -.. code-block:: - - POWERLINE_PROMPT_USER_INFO_MODE="sudo" - - -For now, the only supported value is ``sudo``\ , which hides the username and hostname, and shows an indicator when ``sudo`` has the credentials cached. Other values have no effect at this time. - -Clock Format -^^^^^^^^^^^^ - -You can change the format using the following variable: - -.. code-block:: - - THEME_CLOCK_FORMAT="%H:%M:%S" - - -The time/date is printed by the ``date`` command, so refer to its man page to change the format. - -Segment Order -^^^^^^^^^^^^^ - -The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: - - -* ``aws_profile`` - Show the current value of the ``AWS_PROFILE`` environment variable -* ``battery`` - Battery information (you'll need to enable the ``battery`` plugin) -* ``clock`` - Current time in ``HH:MM:SS`` format -* ``cwd`` - Current working directory including full folder hierarchy (c.f. ``wd``\ ) -* ``hostname`` - Host name of machine -* ``in_vim`` - Show identifier if running in ``:terminal`` from vim -* ``k8s_context`` - Show current kubernetes context -* ``last_status`` - Exit status of last run command -* ``python_venv`` - Python virtual environment information (\ ``virtualenv``\ , ``venv`` - and ``conda`` supported) -* ``ruby`` - Current ruby version if using ``rvm`` -* ``node`` - Current node version (only ``nvm`` is supported) -* ``scm`` - Version control information, ``git`` -* ``terraform`` - Current terraform workspace -* ``user_info`` - Current user -* ``wd`` - Working directory, like ``cwd`` but doesn't show the full folder - hierarchy, only the directory you're currently in. -* ``shlvl`` - Show the current shell level (based on ``SHLVL`` environment variable), but only if you are not in root shell -* ``dirstack`` - Show the current dirstack level (based on ``DIRSTACK`` environment variable), but only if the stack is not empty -* ``history_number`` - Show current history number -* ``command_number`` - Show current command number - -A variable can be defined to set the order of the prompt segments: - -.. code-block:: - - POWERLINE_PROMPT="user_info scm python_venv ruby cwd" - - -The example values above are the current default values, but if you want to remove anything from the prompt, simply remove the "string" that represents the segment from the variable. - -Compact Settings -^^^^^^^^^^^^^^^^ - -You can configure various aspects of the prompt to use less whitespace. Supported variables are: - -.. list-table:: - :header-rows: 1 - - * - Variable - - Description - * - POWERLINE_COMPACT_BEFORE_SEPARATOR - - Removes the leading space before each separator - * - POWERLINE_COMPACT_AFTER_SEPARATOR - - Removes the trailing space after each separator - * - POWERLINE_COMPACT_BEFOR_FIRST_SEGMENT - - Removes the leading space on the first segment - * - POWERLINE_COMPACT_AFTER_LAST_SEGMENT - - Removes the trailing space on the last segment - * - POWERLINE_COMPACT_PROMPT - - Removes the space after the prompt character - * - POWERLINE_COMPACT - - Enable all Compact settings (you can still override individual settings) - - -The default value for all settings is ``0`` (disabled). Use ``1`` to enable. +See :ref:`powerline_base` for general information about the powerline theme. diff --git a/docs/themes-list/powerline-plain.rst b/docs/themes-list/powerline-plain.rst index ae575f57..a7f47c5a 100644 --- a/docs/themes-list/powerline-plain.rst +++ b/docs/themes-list/powerline-plain.rst @@ -4,118 +4,11 @@ Powerline Plain Theme ===================== A colorful theme, where shows a lot information about your shell session. +The plain powerline theme provides a simpler shell with less information. -Provided Information --------------------- +See :ref:`powerline_base` for general information about the powerline theme. +Soft Separators +^^^^^^^^^^^^^^^ -* Current path -* Current username and hostname -* Current time -* Current shell level -* Current dirstack level (\ ``pushd`` / ``popd``\ ) -* Current history number -* Current command number -* An indicator when connected by SSH -* An indicator when ``sudo`` has the credentials cached (see the ``sudo`` manpage for more info about this) -* An indicator when the current shell is inside the Vim editor -* Battery charging status (depends on the battery plugin) -* SCM Repository status (e.g. Git, SVN) -* The current Kubernetes environment -* The current Python environment (Virtualenv, venv, and Conda are supported) in use -* The current Ruby environment (rvm and rbenv are supported) in use -* Last command exit code (only shown when the exit code is greater than 0) - -Configuration -------------- - -This theme is pretty configurable, all the configuration is done by setting environment variables. - -User Information -^^^^^^^^^^^^^^^^ - -By default, the username and hostname are shown, but you can change this behavior by setting the value of the following variable: - -.. code-block:: - - POWERLINE_PROMPT_USER_INFO_MODE="sudo" - - -For now, the only supported value is ``sudo``\ , which hides the username and hostname, and shows an indicator when ``sudo`` has the credentials cached. Other values have no effect at this time. - -Clock Format -^^^^^^^^^^^^ - -You can change the format using the following variable: - -.. code-block:: - - THEME_CLOCK_FORMAT="%H:%M:%S" - - -The time/date is printed by the ``date`` command, so refer to its man page to change the format. - -Segment Order -^^^^^^^^^^^^^ - -The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: - - -* ``aws_profile`` - Show the current value of the ``AWS_PROFILE`` environment variable -* ``battery`` - Battery information (you'll need to enable the ``battery`` plugin) -* ``clock`` - Current time in ``HH:MM:SS`` format -* ``cwd`` - Current working directory including full folder hierarchy (c.f. ``wd``\ ) -* ``hostname`` - Host name of machine -* ``in_vim`` - Show identifier if running in ``:terminal`` from vim -* ``k8s_context`` - Show current kubernetes context -* ``last_status`` - Exit status of last run command -* ``python_venv`` - Python virtual environment information (\ ``virtualenv``\ , ``venv`` - and ``conda`` supported) -* ``ruby`` - Current ruby version if using ``rvm`` -* ``node`` - Current node version (only ``nvm`` is supported) -* ``scm`` - Version control information, ``git`` -* ``terraform`` - Current terraform workspace -* ``user_info`` - Current user -* ``wd`` - Working directory, like ``cwd`` but doesn't show the full folder - hierarchy, only the directory you're currently in. -* ``shlvl`` - Show the current shell level (based on ``SHLVL`` environment variable), but only if you are not in root shell -* ``dirstack`` - Show the current dirstack level (based on ``DIRSTACK`` environment variable), but only if the stack is not empty -* ``history_number`` - Show current history number -* ``command_number`` - Show current command number - -A variable can be defined to set the order of the prompt segments: - -.. code-block:: - - POWERLINE_PROMPT="user_info scm python_venv ruby cwd" - - -The example values above are the current default values, but if you want to remove anything from the prompt, simply remove the "string" that represents the segment from the variable. - -Compact Settings -^^^^^^^^^^^^^^^^ - -You can configure various aspects of the prompt to use less whitespace. Supported variables are: - -.. list-table:: - :header-rows: 1 - - * - Variable - - Description - * - POWERLINE_COMPACT_BEFORE_SEPARATOR - - Removes the leading space before each separator - * - POWERLINE_COMPACT_AFTER_SEPARATOR - - Removes the trailing space after each separator - * - POWERLINE_COMPACT_BEFOR_FIRST_SEGMENT - - Removes the leading space on the first segment - * - POWERLINE_COMPACT_AFTER_LAST_SEGMENT - - Removes the trailing space on the last segment - * - POWERLINE_COMPACT_PROMPT - - Removes the space after the prompt character - * - POWERLINE_COMPACT - - Enable all Compact settings (you can still override individual settings) - * - POWERLINE_PROMPT_AFTER - - Adds characters after the prompt - - -The default value for all settings is ``0`` (disabled). Use ``1`` to enable. +Adjacent segments having the same background color will use a less-pronouced (i.e. soft) separator between them. diff --git a/docs/themes-list/powerline.rst b/docs/themes-list/powerline.rst index 7afd866d..afd63ece 100644 --- a/docs/themes-list/powerline.rst +++ b/docs/themes-list/powerline.rst @@ -5,124 +5,9 @@ Powerline Theme A colorful theme, where shows a lot information about your shell session. -**IMPORTANT:** This theme requires that `a font with the Powerline symbols `_ needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator. - -**NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If that is not the case (e.g. if you are running on a corporate network where ``sudo`` usage is tracked), you can set the flag 'export THEME_CHECK_SUDO=false' in your ``~/.bashrc`` or ``~/.bash_profile`` to disable the Powerline theme's ``sudo`` check. This will apply to all ``powerline*`` themes. - -Provided Information --------------------- - - -* Current path -* Current username and hostname -* Current time -* Current shell level -* Current dirstack level (\ ``pushd`` / ``popd``\ ) -* Current history number -* Current command number -* An indicator when connected by SSH -* An indicator when ``sudo`` has the credentials cached (see the ``sudo`` manpage for more info about this) -* An indicator when the current shell is inside the Vim editor -* Battery charging status (depends on the battery plugin) -* SCM Repository status (e.g. Git, SVN) -* The current Kubernetes environment -* The current Python environment (Virtualenv, venv, and Conda are supported) in use -* The current Ruby environment (rvm and rbenv are supported) in use -* Last command exit code (only shown when the exit code is greater than 0) - -Configuration -------------- - -This theme is pretty configurable, all the configuration is done by setting environment variables. - -User Information -^^^^^^^^^^^^^^^^ - -By default, the username and hostname are shown, but you can change this behavior by setting the value of the following variable: - -.. code-block:: bash - - export POWERLINE_PROMPT_USER_INFO_MODE="sudo" - - -For now, the only supported value is ``sudo``\ , which hides the username and hostname, and shows an indicator when ``sudo`` has the credentials cached. Other values have no effect at this time. - -Clock Format -^^^^^^^^^^^^ - -You can change the format using the following variable: - -.. code-block:: bash - - export THEME_CLOCK_FORMAT="%H:%M:%S" - - -The time/date is printed by the ``date`` command, so refer to its man page to change the format. +See :ref:`powerline_base` for general information about the powerline theme. Soft Separators ^^^^^^^^^^^^^^^ Adjacent segments having the same background color will use a less-pronouced (i.e. soft) separator between them. - -Segment Order -^^^^^^^^^^^^^ - -The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: - - -* ``aws_profile`` - Show the current value of the ``AWS_PROFILE`` environment variable -* ``battery`` - Battery information (you'll need to enable the ``battery`` plugin) -* ``clock`` - Current time in ``HH:MM:SS`` format -* ``cwd`` - Current working directory including full folder hierarchy (c.f. ``wd``\ ) -* ``hostname`` - Host name of machine -* ``in_vim`` - Show identifier if running in ``:terminal`` from vim -* ``k8s_context`` - Show current kubernetes context -* ``last_status`` - Exit status of last run command -* ``python_venv`` - Python virtual environment information (\ ``virtualenv``\ , ``venv`` - and ``conda`` supported) -* ``ruby`` - Current ruby version if using ``rvm`` -* ``node`` - Current node version (only ``nvm`` is supported) -* ``scm`` - Version control information, ``git`` -* ``terraform`` - Current terraform workspace -* ``user_info`` - Current user -* ``wd`` - Working directory, like ``cwd`` but doesn't show the full folder - hierarchy, only the directory you're currently in. -* ``shlvl`` - Show the current shell level (based on ``SHLVL`` environment variable), but only if you are not in root shell -* ``dirstack`` - Show the current dirstack level (based on ``DIRSTACK`` environment variable), but only if the stack is not empty -* ``history_number`` - Show current history number -* ``command_number`` - Show current command number - -A variable can be defined to set the order of the prompt segments: - -.. code-block:: - - POWERLINE_PROMPT="user_info scm python_venv ruby cwd" - - -The example values above are the current default values, but if you want to remove anything from the prompt, simply remove the "string" that represents the segment from the variable. - -Compact Settings -^^^^^^^^^^^^^^^^ - -You can configure various aspects of the prompt to use less whitespace. Supported variables are: - -.. list-table:: - :header-rows: 1 - - * - Variable - - Description - * - POWERLINE_COMPACT_BEFORE_SEPARATOR - - Removes the leading space before each separator - * - POWERLINE_COMPACT_AFTER_SEPARATOR - - Removes the trailing space after each separator - * - POWERLINE_COMPACT_BEFOR_FIRST_SEGMENT - - Removes the leading space on the first segment - * - POWERLINE_COMPACT_AFTER_LAST_SEGMENT - - Removes the trailing space on the last segment - * - POWERLINE_COMPACT_PROMPT - - Removes the space after the prompt character - * - POWERLINE_COMPACT - - Enable all Compact settings (you can still override individual settings) - - -The default value for all settings is ``0`` (disabled). Use ``1`` to enable. From e7d51070079d7c94d5488950ed8b85b4e6b9931a Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sun, 13 Dec 2020 23:47:39 +0200 Subject: [PATCH 65/68] docs: Improve contributing add-screenshot instructions --- docs/contributing.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/contributing.rst b/docs/contributing.rst index 98c37761..655d05bd 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -105,5 +105,14 @@ 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. - The project's docs has a `Themes page `_ where you can add a screenshot if you want (by link). + The project's docs has a `Themes page `_ where you should add a screenshot, see how :ref:`here`. * Ideally, you should add a ``.rst`` file describing the theme and its configuration options to ``docs/themes-list`` folder. + +.. _add_screenshot: + +Adding a Screenshot +------------------- + +In order to add a new screenshot, use the ``gh-pages`` branch. +Add your new screenshot to the ``docs/images`` folder, and open a PR. +In the `Themes page `_, see the other screenshots to know what kind of link you should use. From 0d7f145ef4f9c8487fc40a989500dab923aa6044 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Mon, 14 Dec 2020 00:28:57 +0200 Subject: [PATCH 66/68] readme: Change join chat to IRC from gitter --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index f8e94995..ee233fc4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,6 +1,6 @@ # Bash-it ![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) +[![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+. (And a shameless ripoff of [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) :smiley:) From b5fecb3eb30228f4016bb6fd4b3f01b6de52bc2e Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Mon, 14 Dec 2020 00:47:32 +0200 Subject: [PATCH 67/68] readme: Add docs status badge --- docs/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/README.md b/docs/README.md index ee233fc4..39753bbd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,6 @@ # Bash-it ![Build Status](https://github.com/Bash-it/bash-it/workflows/CI/badge.svg?branch=master) +![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+. From 654a49cbd81b56a2ec7d13eadec7082b0bc5f0c0 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Mon, 14 Dec 2020 00:49:26 +0200 Subject: [PATCH 68/68] docs: Add readthedocs main page to readme --- docs/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/README.md b/docs/README.md index f8e94995..1aa255c4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -11,6 +11,7 @@ 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) - [Install Options](https://bash-it.readthedocs.io/en/latest/installation/#install-options)