75 Commits

Author SHA1 Message Date
Noah Gorny
e89403d59b Merge pull request #1881 from NoahGorny/lint-pure-theme
Refactor scm_prompt usage in many themes
2021-08-03 23:22:09 +03:00
cornfeedhobo
e13f7d1b07 Merge pull request #1901 from cornfeedhobo/libera-chat
move to Libera.Chat
2021-07-11 11:30:21 -05:00
cornfeedhobo
aad58bc910 move to Libera.Chat 2021-07-06 22:21:46 -05:00
Ron Green
d4ebba174c feat(git): add git unpushed alias (#1897)
* feat(git): add git unpushed alias
2021-06-23 15:02:04 +03:00
Zhengnan Zhao
0f3e4dc8be Have git check out main branch if present (#1886)
Create function to get default git branch, and use main branch if present
2021-06-23 13:26:48 +03:00
Gurkirat Singh
e51fe1fe2b Abort upgrade if unsaved changes found in bashit directory (#1890)
helper (improvement): added safeguard for unsaved changes
2021-06-23 13:25:42 +03:00
Noah Gorny
d979c32c8a Merge pull request #1891 from tbhaxor/bugfix/helper/upgrade
Replace reload with restart bash it after upgrade
2021-06-23 13:24:49 +03:00
Noah Gorny
f6e3fc358c Merge pull request #1898 from tbhaxor/bugfix/lint/wpscan
FIxed wpscan completion linting
2021-06-23 13:22:25 +03:00
Noah Gorny
e70211549f Merge pull request #1899 from georgettica/georgettica/bump-pre-commit-hooks
chore(pre-commit): bump version
2021-06-23 13:21:06 +03:00
Ron Green
a3f5b5f29a chore(pre-commit): bump version
done in the beginning because of build issues, but was solved during the work on #1897
2021-06-17 10:37:19 +03:00
Gurkirat Singh
682fd32a13 lint (bugfix): wpscan completion linting fix 2021-06-17 08:51:02 +05:30
Gurkirat Singh
01b916c544 helpers (bugfix): restart bashit after upgrade 2021-06-11 12:41:28 +05:30
ofir shtrull
2444a57cc5 feat: add k8s namespace indicator (#1887)
* Add k8s namespace to prompt
2021-06-10 16:04:56 +03:00
Noah Gorny
9b62a5c4df Merge pull request #1888 from clupasq/feature/powerline-command-duration
Add command duration to the powerline theme family
2021-06-10 16:04:28 +03:00
Cristian Lupascu
1e6113f7b7 Add command duration to the powerline theme family
Fix the __powerline_duration_prompt: location & unused variable `prompt`

Remove the duration segment from powerline* theme defaults

Different color for duration prompt segment
2021-06-05 13:47:54 +03:00
Noah Gorny
dff892e0a3 themes: Adapt themes to new scm_prompt api 2021-05-16 19:17:02 +03:00
Noah Gorny
2ae0350f5d themes: base: Add unified scm_prompt function 2021-05-16 19:17:02 +03:00
Noah Gorny
b65a7cc67c themes: Lint pure theme 2021-05-16 13:59:18 +03:00
Noah Gorny
7f193a2e05 Add pure theme to clean_files.txt 2021-05-16 13:52:36 +03:00
Noah Gorny
8c47706139 Merge pull request #1877 from NoahGorny/fix-alias-completion-for-real
plugins: Fix alias-completion by comparing completions to alias literally
2021-05-15 18:58:15 +03:00
Noah Gorny
2120be9372 plugins: Fix alias-completion by using helper util
By using _bash-it-array-contains-element, we can safetly iterate over
elements in the $completions array
2021-05-15 11:42:10 +03:00
Noah Gorny
476c568566 Merge pull request #1874 from oliverralbertini/add-hg-bookmarks-support
[base.theme] add support for hg's bookmarks feature
2021-05-08 00:13:20 +03:00
Oliver Ruben Albertini
26118d1835 [base.theme] add support for hg's bookmarks feature
Will conditionally show the branch based on the current bookmark instead
of branch.
2021-04-27 11:36:14 -07:00
Noah Gorny
d3bb347786 Merge pull request #1837 from NoahGorny/vendor-jboss-completion
vendor jboss completion
2021-04-27 01:32:34 +03:00
Noah Gorny
b8da4cb68c Merge pull request #1875 from NoahGorny/fix-alias-completion
plugins: alias-completion: Revert back to read without -r
2021-04-23 17:05:17 +03:00
Noah Gorny
940739a8a0 Merge pull request #1873 from NoahGorny/improve-clean-files-txt
Add clean_files.txt sorting hook
2021-04-23 00:19:05 +03:00
Noah Gorny
716b49fa0e lint: Sort clean_files.txt according to check-clean-files-txt.sh 2021-04-22 20:53:30 +03:00
Noah Gorny
e15b53ea61 hooks: Use compat31 in check-clean-files-txt.sh 2021-04-22 20:53:30 +03:00
Noah Gorny
1b7448bc9d plugins: alias-completion: Revert back to read without -r 2021-04-22 20:38:30 +03:00
Noah Gorny
d0aa9cb542 hooks: Add check-clean-files-txt.sh 2021-04-22 01:48:20 +03:00
Noah Gorny
c731e45770 lint: Make clean_files.txt more tidy 2021-04-22 01:48:13 +03:00
John Fred Fadrigalan
7b8dbd39bc Clean alias completion plugin (#1872)
* Sort plugins/available

* Clean alias-completion plugin

* Fix shellcheck warning. SC1090

* Change shellcheck source to /dev/null for explicity

* Disable shellcheck warning SC2162
2021-04-22 01:46:50 +03:00
Noah Gorny
31bea24da6 Merge pull request #1859 from tbhaxor/feature/completion/dmidecode
Feature/completion/dmidecode
2021-04-22 01:41:56 +03:00
Noah Gorny
7cd94e1f7f Merge pull request #1870 from cevhyruz/clean-candy-theme
Clean candy theme
2021-04-19 21:49:23 +03:00
John Fred Fadrigalan
370c5b349e Sort theme section 2021-04-20 01:48:37 +08:00
John Fred Fadrigalan
c0fa514f7d Place 'theme/clean' alphabetically on clean_files.txt 2021-04-20 01:40:52 +08:00
John Fred Fadrigalan
409e18f7cb Clean candy theme 2021-04-20 01:18:40 +08:00
Noah Gorny
5e723842b8 Merge pull request #1869 from NoahGorny/add-restart-docs
docs: Add a section about bash-it restart
2021-04-14 19:28:12 +03:00
Noah Gorny
7e620fed63 docs: Add a section about bash-it restart 2021-04-14 16:55:23 +03:00
Noah Gorny
58f2240789 Merge pull request #1845 from NoahGorny/docs-add-logo
docs: Add logo of bash-it to readme
2021-04-08 21:48:31 +03:00
Noah Gorny
2201f6658b Add 2021 to license 2021-04-06 20:59:08 +03:00
Noah Gorny
c7f125a85d docs: Improve readme readability 2021-04-06 20:58:26 +03:00
Noah Gorny
80f143c90b docs: Add nice badges to readme 2021-04-06 20:56:31 +03:00
Noah Gorny
5d809dd73d docs: Add logo of bash-it to readme 2021-04-06 20:56:31 +03:00
Noah Gorny
ebe59c9adc Merge pull request #1850 from tbhaxor/feature/completion/ngrok
Added completion for ngrok tool
2021-04-04 22:36:13 +03:00
Noah Gorny
a6e2c2fc13 Merge pull request #1863 from artemkovalyov/patch-2
add --no-start to docker-compose up command
2021-04-04 22:35:19 +03:00
Noah Gorny
6678788f19 Merge pull request #1857 from bingzhangdai/bindai/extract-plugin
Update extract.plugin.bash, extract compressed file to target directory
2021-04-04 22:34:48 +03:00
Noah Gorny
4f0fa7ebe7 Merge pull request #1862 from NoahGorny/fix-install-error
install: Dont quote number vars, to support older bash versions
2021-04-04 22:34:25 +03:00
Artem Kovalov
905abd37f8 add --no-start to up command 2021-04-03 13:15:04 +02:00
Noah Gorny
a8b43620f8 install: Dont quote number vars, to support older bash versions 2021-04-01 17:59:59 +03:00
Noah Gorny
0239ab8c31 completion: ngrok: Add --help option 2021-04-01 00:37:49 +03:00
Noah Gorny
1dfaf36d91 completion: ngrok: Only complete the list in case prev is ngrok 2021-04-01 00:37:49 +03:00
Noah Gorny
e06066c367 Merge pull request #1842 from Titivoot/master
easy theme added
2021-04-01 00:35:15 +03:00
Gurkirat Singh
035fc920ad completion (improvement): remove if statement 2021-04-01 00:34:37 +03:00
Gurkirat Singh
ab011cd9ba completion (improvement): fixed linting 2021-04-01 00:34:37 +03:00
Gurkirat Singh
d42a1206f9 completion (feature): implemented ngrok 2021-04-01 00:34:37 +03:00
Noah Gorny
ce854255b4 Merge pull request #1833 from NoahGorny/add-license-to-docs
add license to docs
2021-04-01 00:29:07 +03:00
Noah Gorny
9524bf85ae docs: Add easy theme to themes image list 2021-04-01 00:28:28 +03:00
Titivoot Pangrit
6866648ac6 Add theme Easy 2021-04-01 00:28:28 +03:00
Noah Gorny
514a753901 Merge pull request #1858 from lintonf/patch-1
Fix spelling mistake with terraform destroy alias
2021-03-31 23:56:58 +03:00
Gurkirat Singh
e481eb41e5 completion (improvement): dmidecode lint fixed 2021-03-30 11:03:18 +05:30
Gurkirat Singh
a3ae37b385 completion (feature): dmidecode 2021-03-30 11:01:19 +05:30
Linton Fisher
0b808b17f1 Fix spelling mistake 2021-03-30 00:57:13 +01:00
Noah Gorny
4860fb8c60 Merge pull request #1849 from tiagobarros99/purity-add-virtualenv
purity theme, added virtualenv name display
2021-03-25 19:16:35 +02:00
tiago
cda81f3d74 cleaned and linted purity theme 2021-03-24 21:39:57 +00:00
Bingzhang Dai
7331cd2676 Update extract.plugin.bash 2021-03-24 18:42:44 +08:00
Bingzhang Dai
399b5199b0 Update extract.plugin.bash, support to extract zip to target directory 2021-03-24 17:04:21 +08:00
tiago
64c4c30706 minor change 2021-03-17 15:39:57 +00:00
tiago
ea444459cf improved PS1, function rename 2021-03-17 15:26:39 +00:00
tiago
682d6d728d added python's virtualenv name 2021-03-10 15:24:32 +00:00
Noah Gorny
64d827c3da completion: Use vendored jboss completion
Also include new jboss5 vendored completion
2021-02-13 10:41:16 +02:00
Noah Gorny
a30a76906c Add "jboss-completion" from "https://github.com/rparree/jboss-bash-completion@master"
git-vendor-name: jboss-completion
git-vendor-dir: vendor/github.com/rparree/jboss-bash-completion
git-vendor-repository: https://github.com/rparree/jboss-bash-completion
git-vendor-ref: master
2021-02-13 10:34:49 +02:00
Noah Gorny
e89948a7f0 Squashed 'vendor/github.com/rparree/jboss-bash-completion/' content from commit fc87d94
git-subtree-dir: vendor/github.com/rparree/jboss-bash-completion
git-subtree-split: fc87d94e7da9431133190f60f5a84367e44d650c
2021-02-13 10:34:49 +02:00
Noah Gorny
e25e371ba7 docs: Add newline in readme and index.rst 2021-02-06 23:17:18 +02:00
Noah Gorny
e4e0c151b2 docs: Add license notice to readme 2021-02-06 23:16:58 +02:00
49 changed files with 765 additions and 489 deletions

View File

@@ -15,7 +15,7 @@ repos:
- id: mixed-line-ending - id: mixed-line-ending
- id: check-added-large-files - id: check-added-large-files
- repo: https://github.com/jumanjihouse/pre-commit-hooks - repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 2.1.4 rev: 2.1.5
hooks: hooks:
- id: git-check # Configure in .gitattributes - id: git-check # Configure in .gitattributes
- id: shellcheck - id: shellcheck
@@ -43,3 +43,8 @@ repos:
language: system language: system
files: "\\.bash$" files: "\\.bash$"
types: [file] types: [file]
- id: clean-files-txt
name: Check that clean_files.txt is sorted alphabetically.
entry: ./hooks/check-clean-files-txt.sh
language: system
files: clean_files.txt

View File

@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2020 Bash-it Copyright (c) 2020-2021 Bash-it
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -7,3 +7,4 @@ alias dco="docker-compose"
alias dcofresh="docker-compose-fresh" alias dcofresh="docker-compose-fresh"
alias dcol="docker-compose logs -f --tail 100" alias dcol="docker-compose logs -f --tail 100"
alias dcou="docker-compose up" alias dcou="docker-compose up"
alias dcouns="dcou --no-start"

View File

@@ -37,8 +37,8 @@ alias gcb='git checkout -b'
alias gco='git checkout' alias gco='git checkout'
alias gcob='git checkout -b' alias gcob='git checkout -b'
alias gcobu='git checkout -b ${USER}/' alias gcobu='git checkout -b ${USER}/'
alias gcom='git checkout master' alias gcom='git checkout $(get_default_branch)'
alias gcpd='git checkout master; git pull; git branch -D' alias gcpd='git checkout $(get_default_branch); git pull; git branch -D'
alias gct='git checkout --track' alias gct='git checkout --track'
# clone # clone
@@ -64,13 +64,14 @@ alias gf='git fetch --all --prune'
alias gft='git fetch --all --prune --tags' alias gft='git fetch --all --prune --tags'
alias gftv='git fetch --all --prune --tags --verbose' alias gftv='git fetch --all --prune --tags --verbose'
alias gfv='git fetch --all --prune --verbose' alias gfv='git fetch --all --prune --verbose'
alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master' alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/$(get_default_branch)'
alias gup='git fetch && git rebase' alias gup='git fetch && git rebase'
# log # log
alias gg='git log --graph --pretty=format:'\''%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset'\'' --abbrev-commit --date=relative' alias gg='git log --graph --pretty=format:'\''%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset'\'' --abbrev-commit --date=relative'
alias ggf='git log --graph --date=short --pretty=format:'\''%C(auto)%h %Cgreen%an%Creset %Cblue%cd%Creset %C(auto)%d %s'\''' alias ggf='git log --graph --date=short --pretty=format:'\''%C(auto)%h %Cgreen%an%Creset %Cblue%cd%Creset %C(auto)%d %s'\'''
alias ggs='gg --stat' alias ggs='gg --stat'
alias ggup='git log --branches --not --remotes --no-walk --decorate --oneline' # FROM https://stackoverflow.com/questions/39220870/in-git-list-names-of-branches-with-unpushed-commits
alias gll='git log --graph --pretty=oneline --abbrev-commit' alias gll='git log --graph --pretty=oneline --abbrev-commit'
alias gnew='git log HEAD@{1}..HEAD@{0}' # Show commits since last pull, see http://blogs.atlassian.com/2014/10/advanced-git-aliases/ alias gnew='git log HEAD@{1}..HEAD@{0}' # Show commits since last pull, see http://blogs.atlassian.com/2014/10/advanced-git-aliases/
alias gwc='git whatchanged' alias gwc='git whatchanged'
@@ -104,7 +105,7 @@ alias gp='git push'
alias gpd='git push --delete' alias gpd='git push --delete'
alias gpf='git push --force' alias gpf='git push --force'
alias gpo='git push origin HEAD' alias gpo='git push origin HEAD'
alias gpom='git push origin master' alias gpom='git push origin $(get_default_branch)'
alias gpu='git push --set-upstream' alias gpu='git push --set-upstream'
alias gpunch='git push --force-with-lease' alias gpunch='git push --force-with-lease'
alias gpuo='git push --set-upstream origin' alias gpuo='git push --set-upstream origin'
@@ -112,7 +113,7 @@ alias gpuoc='git push --set-upstream origin $(git symbolic-ref --short HEAD)'
# pull # pull
alias gl='git pull' alias gl='git pull'
alias glum='git pull upstream master' alias glum='git pull upstream $(get_default_branch)'
alias gpl='git pull' alias gpl='git pull'
alias gpp='git pull && git push' alias gpp='git pull && git push'
alias gpr='git pull --rebase' alias gpr='git pull --rebase'
@@ -128,9 +129,9 @@ alias grm='git rm'
# rebase # rebase
alias grb='git rebase' alias grb='git rebase'
alias grbc='git rebase --continue' alias grbc='git rebase --continue'
alias grm='git rebase master' alias grm='git rebase $(get_default_branch)'
alias grmi='git rebase master -i' alias grmi='git rebase $(get_default_branch) -i'
alias gprom='git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master' # Rebase with latest remote master alias gprom='git fetch origin $(get_default_branch) && git rebase origin/$(get_default_branch) && git update-ref refs/heads/$(get_default_branch) origin/$(get_default_branch)' # Rebase with latest remote
# reset # reset
alias gus='git reset HEAD' alias gus='git reset HEAD'
@@ -174,7 +175,7 @@ alias gsu='git submodule update --init --recursive'
# these aliases requires git v2.23+ # these aliases requires git v2.23+
alias gsw='git switch' alias gsw='git switch'
alias gswc='git switch --create' alias gswc='git switch --create'
alias gswm='git switch master' alias gswm='git switch $(get_default_branch)'
alias gswt='git switch --track' alias gswt='git switch --track'
# tag # tag
@@ -196,3 +197,11 @@ esac
function gdv() { function gdv() {
git diff --ignore-all-space "$@" | vim -R - git diff --ignore-all-space "$@" | vim -R -
} }
function get_default_branch() {
if git branch | grep -q main; then
echo main
else
echo master
fi
}

View File

@@ -7,4 +7,4 @@ alias tf='terraform'
alias tfv='terraform validate' alias tfv='terraform validate'
alias tfp='terraform plan' alias tfp='terraform plan'
alias tfa='terraform apply' alias tfa='terraform apply'
alias tfd='terraform destory' alias tfd='terraform destroy'

View File

@@ -1,7 +1,7 @@
####################################################################### #######################################################################
# Allow-list of files to be lint-checked by CI # Allow-list of files to be lint-checked by CI
# #
# Directory Suport # Directory Support
# Directory references are allowed within the file, ie: # Directory references are allowed within the file, ie:
# #
# themes/powerline # themes/powerline
@@ -16,47 +16,22 @@
# root directories # root directories
# #
docs docs/
hooks hooks/
# root files # root files
# #
.gitattributes .gitattributes
lint_clean_files.sh
install.sh
bash_it.sh bash_it.sh
clean_files.txt
install.sh
lint_clean_files.sh
# themes # aliases
# #
themes/agnoster aliases/available/dnf.aliases.bash
themes/90210 aliases/available/git.aliases.bash
themes/powerline aliases/available/vim.aliases.bash
themes/barbuk
themes/atomic
themes/axin
themes/base.theme.bash
themes/bakke
themes/binaryanomaly
themes/bira
themes/bobby
themes/bobby-python
themes/brainy
themes/brunton
themes/command_duration.theme.bash
themes/modern
# plugins
#
plugins/available/basher.plugin.bash
plugins/available/cmd-returned-notify.plugin.bash
plugins/available/docker-machine.plugin.bash
plugins/available/git.plugin.bash
plugins/available/go.plugin.bash
plugins/available/goenv.plugin.bash
plugins/available/history.plugin.bash
plugins/available/history-search.plugin.bash
plugins/available/history-substring-search.plugin.bash
plugins/available/xterm.plugin.bash
# completions # completions
# #
@@ -68,19 +43,23 @@ completion/available/composer.completion.bash
completion/available/conda.completion.bash completion/available/conda.completion.bash
completion/available/consul.completion.bash completion/available/consul.completion.bash
completion/available/django.completion.bash completion/available/django.completion.bash
completion/available/docker.completion.bash completion/available/dmidecode.completion.bash
completion/available/docker-machine.completion.bash completion/available/docker-machine.completion.bash
completion/available/docker.completion.bash
completion/available/gcloud.completion.bash completion/available/gcloud.completion.bash
completion/available/gem.completion.bash completion/available/gem.completion.bash
completion/available/go.completion.bash
completion/available/github-cli.completion.bash completion/available/github-cli.completion.bash
completion/available/go.completion.bash
completion/available/helm.completion.bash completion/available/helm.completion.bash
completion/available/jboss5.completion.bash
completion/available/jboss7.completion.bash
completion/available/jungle.completion.bash completion/available/jungle.completion.bash
completion/available/knife.completion.bash completion/available/knife.completion.bash
completion/available/kontena.completion.bash completion/available/kontena.completion.bash
completion/available/kubectl.completion.bash completion/available/kubectl.completion.bash
completion/available/lerna.completion.bash completion/available/lerna.completion.bash
completion/available/minikube.completion.bash completion/available/minikube.completion.bash
completion/available/ngrok.completion.bash
completion/available/notify-send.completion.bash completion/available/notify-send.completion.bash
completion/available/npm.completion.bash completion/available/npm.completion.bash
completion/available/packer.completion.bash completion/available/packer.completion.bash
@@ -89,19 +68,54 @@ completion/available/pip3.completion.bash
completion/available/pipenv.completion.bash completion/available/pipenv.completion.bash
completion/available/pipx.completion.bash completion/available/pipx.completion.bash
completion/available/rustup.completion.bash completion/available/rustup.completion.bash
completion/available/vault.completion.bash
completion/available/sdkman.completion.bash completion/available/sdkman.completion.bash
completion/available/vault.completion.bash
completion/available/vuejs.completion.bash completion/available/vuejs.completion.bash
completion/available/wpscan.completion.bash
# aliases # plugins
# #
aliases/available/dnf.aliases.bash plugins/available/alias-completion.plugin.bash
aliases/available/vim.aliases.bash plugins/available/basher.plugin.bash
aliases/available/git.aliases.bash plugins/available/cmd-returned-notify.plugin.bash
plugins/available/docker-machine.plugin.bash
plugins/available/git.plugin.bash
plugins/available/go.plugin.bash
plugins/available/goenv.plugin.bash
plugins/available/history-search.plugin.bash
plugins/available/history-substring-search.plugin.bash
plugins/available/history.plugin.bash
plugins/available/xterm.plugin.bash
# tests # tests
#
test/plugins/alias-completion.plugin.bats
test/test_helper.bash test/test_helper.bash
# themes
#
themes/90210
themes/agnoster
themes/atomic
themes/axin
themes/bakke
themes/barbuk
themes/base.theme.bash
themes/binaryanomaly
themes/bira
themes/bobby
themes/bobby-python
themes/brainy
themes/brunton
themes/candy
themes/command_duration.theme.bash
themes/easy
themes/modern
themes/powerline
themes/pure
themes/purity
# vendor init files # vendor init files
#
vendor/.gitattributes vendor/.gitattributes
vendor/init.d vendor/init.d

View File

@@ -0,0 +1,20 @@
# shellcheck shell=bash
function __dmidecode_completion() {
local prev=$(_get_pword)
local curr=$(_get_cword)
case $prev in
-s | --string | -t | --type)
OPTS=$(dmidecode "$prev" 2>&1 | grep -E '^ ' | sed 's/ *//g')
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$OPTS" -- "$curr"))
;;
dmidecode)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "-d --dev-mem -h --help -q --quiet -s --string -t --type -H --handle -u --dump{,-bin} --from-dump --no-sysfs --oem-string -V --version" -- "$curr"))
;;
esac
}
complete -F __dmidecode_completion dmidecode

View File

@@ -0,0 +1,4 @@
# shellcheck shell=bash
about-completion "jboss5 completion"
# shellcheck disable=SC1090
source "${BASH_IT}"/vendor/github.com/rparree/jboss-bash-completion/jboss5

View File

@@ -1,160 +1,4 @@
# Completions for JBoss Application Server 7 (EAP 6) # shellcheck shell=bash
# VERSION: 0.6 about-completion "jboss7 completion"
# DATE: 2012-10-30 # shellcheck disable=SC1090
# rparree-at-edc4it-dot-com source "${BASH_IT}"/vendor/github.com/rparree/jboss-bash-completion/jboss7
# MIT License
# Copyright (c) 2020 Raphael Parree
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
_serverProfiles(){
if [[ $COMP_WORDS == *standalone.sh* ]]
then
serverdir="../standalone/configuration/"
else
# assume is domain.sh
serverdir="../domain/configuration/"
fi
for i in ${!COMP_WORDS[*]}
do
if [[ "${COMP_WORDS[i]}" == "-Djboss.server.base.dir" || "${COMP_WORDS[i]}" == "-Djboss.domain.base.dir" ]]; then
serverdir="${COMP_WORDS[i+2]}/configuration"
fi
done
if [ -d "${serverdir}" ]
then
IFS=$'\n' tmp="$(ls "${serverdir}" | grep xml)"
local fls="${tmp[@]// /\ }"
unset IFS
COMPREPLY=( $(compgen -W "${fls} initial boot last v" -- "$cur" ))
fi
}
_bindingAddress(){
# from /etc/bash_completion.d/ssh
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
"0.0.0.0 $( PATH="$PATH:/sbin" ifconfig -a | \
sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' \
-ne 's/.*inet[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' )" \
-- "$cur" ) )
}
_jboss(){
local cur prev words cword
COMPREPLY=()
_get_comp_words_by_ref -n = cur prev words cword
case $cur in
-Djboss.socket.binding.port-offset=*)
cur=${cur#*=}
#static list of common bindings sets
local bindings="100 200 300 400 10000 20000 30000 40000"
COMPREPLY=( $(compgen -W "${bindings}" -- ${cur}) )
return 0
;;
-Djboss.default.jgroups.stack=*)
cur=${cur#*=}
#static list of standard JGroups stacks
local stacks="udp udp-async udp-sync tcp tcp-sync"
COMPREPLY=( $(compgen -W "${stacks}" -- ${cur}) )
return 0
;;
-Dorg.jboss.ejb3.remoting.IsLocalInterceptor.passByRef=*|-Dcom.sun.management.jmxremote.authenticate=*|-Dcom.sun.management.jmxremote.ssl=*)
cur=${cur#*=}
local booleans="true false"
COMPREPLY=( $(compgen -W "${booleans}" -- ${cur}) )
return 0
;;
-Djboss.server.base.dir=*|-Djboss.home.dir=*|-Djboss.domain.base.dir=*)
cur=${cur#*=}
_filedir -d
return 0
;;
-Djboss.domain.master.address=*|-Djboss.bind.address*=*)
cur=${cur#*=}
_bindingAddress
return 0
;;
--server-config=*|-c=|--host-config=*)
cur=${cur#*=}
_serverProfiles
return 0
esac
case $prev in
-u)
# a few from RFC 2365 IPv4 Local Scope ()
local addresses="239.255.0.1 239.255.0.2 239.255.0.3"
COMPREPLY=( $(compgen -W "${addresses}" -- ${cur}) )
return 0
;;
-b*)
_bindingAddress
return 0
;;
-c)
_serverProfiles
return 0
;;
*)
;;
esac
# *** from jboss5 ********************
# *** -modulepath -c -m -g -l -d -p -n -B -L -C -Djboss.platform.mbeanserver -Djboss.server.base.directory
# *** -Djboss.Domain -Djboss.modcluster.proxyList -Djboss.jvmRoute -Djboss.default.jgroups.stack -Dorg.jboss.ejb3.remoting.IsLocalInterceptor.passByRef -Djboss.platform.mbeanserver -Dcom.sun.management.jmxremote.port -Dcom.sun.management.jmxremote.ssl
# *************************************
# standard commands for standalone and domain mode
local commandsWithoutEqualSign='-b -bmanagement -bunsecure -bpublic --admin-only -h -help -u -version -V -v'
local commandsWithEqualSign='-P -Djboss.node.name -Djboss.home.dir -Djboss.socket.binding.port-offset -Djboss.bind.address.management -Djboss.bind.address -Djboss.bind.address.unsecure'
if [[ $COMP_WORDS == *standalone.sh* ]]
then
commandsWithoutEqualSign="${commandsWithoutEqualSign} -c"
commandsWithEqualSign="${commandsWithEqualSign} --server-config -Djboss.server.base.dir -c"
else
# assume is domain.sh
commandsWithoutEqualSign="${commandsWithoutEqualSign} --backup --cached-dc"
commandsWithEqualSign="${commandsWithEqualSign} -Djboss.domain.master.address --host-config -Djboss.domain.master.port -Djboss.domain.base.dir "
fi
COMPREPLY=( $( compgen -W "$commandsWithoutEqualSign" -- "$cur" )
$( compgen -W "$commandsWithEqualSign" -S '=' -- "$cur" ) )
return 0
}
complete -o nospace -F _jboss standalone.sh
complete -o nospace -F _jboss domain.sh

View File

@@ -0,0 +1,45 @@
# shellcheck shell=bash
__ngrok_completion() {
local prev=$(_get_pword)
local curr=$(_get_cword)
local BASE_NO_CONF="--log --log-format --log-level --help"
local BASE="--config $BASE_NO_CONF"
local DEFAULT="$BASE --authtoken --region"
case $prev in
authtoken)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$BASE" -- "$curr"))
;;
http)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$DEFAULT --auth --bind-tls --host-header --hostname --inspect --subdomain" -- "$curr"))
;;
start)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$DEFAULT --all --none" -- "$curr"))
;;
tcp)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$DEFAULT --remote-addr" -- "$curr"))
;;
tls)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$DEFAULT --client-cas --crt --hostname --key --subdomain" -- "$curr"))
;;
update)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$BASE_NO_CONF --channel" -- "$curr"))
;;
ngrok)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "authtoken credits http start tcp tls update version help" -- "$curr"))
;;
*) ;;
esac
}
complete -F __ngrok_completion ngrok

View File

@@ -1,15 +1,15 @@
#!/usr/bin/bash # shellcheck shell=bash
if command -v wpscan > /dev/null; then if command -v wpscan > /dev/null; then
__wpscan_completion() { __wpscan_completion() {
local OPTS=("--help --hh --version --url --ignore-main-redirect --verbose --output --format --detection-mode --scope --headers --user-agent --vhost --random-user-agent --user-agents-list --http-auth --max-threads --throttle --request-timeout --connect-timeout --disable-tlc-checks --proxy --proxy-auth --cookie-string --cookie-jar --cache-ttl --clear-cache --server --cache-dir --update --no-update --wp-content-dir --wp-plugins-dir --wp-version-detection --main-theme-detection --enumerate --exclude-content-based --plugins-list --plugins-detection --plugins-version-all --plugins-version-detection --themes-list --themes-detection --themes-version-all --themes-version-detection --timthumbs-list --timthumbs-detection --config-backups-list --config-backups-detection --db-exports-list --db-exports-detection --medias-detection --users-list --users-detection --passwords --usernames --multicall-max-passwords --password-attack --stealthy") local OPTS=("--help --hh --version --url --ignore-main-redirect --verbose --output --format --detection-mode --scope --headers --user-agent --vhost --random-user-agent --user-agents-list --http-auth --max-threads --throttle --request-timeout --connect-timeout --disable-tlc-checks --proxy --proxy-auth --cookie-string --cookie-jar --cache-ttl --clear-cache --server --cache-dir --update --no-update --wp-content-dir --wp-plugins-dir --wp-version-detection --main-theme-detection --enumerate --exclude-content-based --plugins-list --plugins-detection --plugins-version-all --plugins-version-detection --themes-list --themes-detection --themes-version-all --themes-version-detection --timthumbs-list --timthumbs-detection --config-backups-list --config-backups-detection --db-exports-list --db-exports-detection --medias-detection --users-list --users-detection --passwords --usernames --multicall-max-passwords --password-attack --stealthy")
COMPREPLY=() COMPREPLY=()
for _opt_ in ${OPTS[@]}; do for _opt_ in "${OPTS[@]}"; do
if [[ "$_opt_" == "$2"* ]]; then if [[ "$_opt_" == "$2"* ]]; then
COMPREPLY+=("$_opt_") COMPREPLY+=("$_opt_")
fi fi
done done
} }
complete -F __wpscan_completion wpscan complete -F __wpscan_completion wpscan
fi fi

View File

@@ -1,7 +1,10 @@
# Bash-it ![logo](https://github.com/Bash-it/media/raw/master/media/Bash-it.png)
![Build Status](https://github.com/Bash-it/bash-it/workflows/CI/badge.svg?branch=master) ![Build Status](https://github.com/Bash-it/bash-it/workflows/CI/badge.svg?branch=master)
![Docs Status](https://readthedocs.org/projects/bash-it/badge/) ![Docs Status](https://readthedocs.org/projects/bash-it/badge/)
[![Join the chat at https://webchat.freenode.net/?channel=#bash-it](https://img.shields.io/badge/chat-on%20freenode-brightgreen.svg)](https://webchat.freenode.net/?channel=#bash-it) ![License](https://img.shields.io/github/license/Bash-it/bash-it)
![shell](https://img.shields.io/badge/Shell-Bash-blue)
[![Join the chat at https://web.libera.chat/?channel=#bash-it](https://img.shields.io/badge/chat-on%20Libera.Chat-brightgreen.svg)](https://web.libera.chat/?channel=#bash-it)
**Bash-it** is a collection of community Bash commands and scripts for Bash 3.2+. **Bash-it** is a collection of community Bash commands and scripts for Bash 3.2+.
(And a shameless ripoff of [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) :smiley:) (And a shameless ripoff of [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) :smiley:)
@@ -9,7 +12,7 @@
Includes autocompletion, themes, aliases, custom functions, a few stolen pieces from Steve Losh, and more. 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. 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! If you're using the _Bourne Again Shell_ (Bash) regularly and have been looking for an easy way on how to keep all of these nice little scripts and aliases under control, then Bash-it is for you!
Stop polluting your `~/bin` directory and your `.bashrc` file, fork/clone Bash-it and start hacking away. Stop polluting your `~/bin` directory and your `.bashrc` file, fork/clone Bash-it and start hacking away.
- [Main Page](https://bash-it.readthedocs.io/en/latest) - [Main Page](https://bash-it.readthedocs.io/en/latest)
@@ -39,7 +42,8 @@ Stop polluting your `~/bin` directory and your `.bashrc` file, fork/clone Bash-i
``git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it`` ``git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it``
2) Run ``~/.bash_it/install.sh`` 2) Run ``~/.bash_it/install.sh``
Thats it! :smiley: That's it! :smiley:
You can check out more components of Bash-it, and customize it to your desire. You can check out more components of Bash-it, and customize it to your desire.
For more information, see detailed instructions [here](https://bash-it.readthedocs.io/en/latest/installation/). For more information, see detailed instructions [here](https://bash-it.readthedocs.io/en/latest/installation/).
@@ -53,6 +57,8 @@ please feel free to read through this page if you're interested in how Bash-it l
## Contributors ## Contributors
* [List of contributors][contribute] [List of contributors](https://github.com/Bash-it/bash-it/contributors)
[contribute]: https://github.com/Bash-it/bash-it/contributors ## License
Bash-it is licensed under the [MIT License](https://github.com/Bash-it/bash-it/blob/master/LICENSE).

View File

@@ -8,3 +8,16 @@ your Bash profile when you make changes.
Additionally, if you export ``BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE`` as a non-null value, 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. Bash-it will automatically reload itself after activating or deactivating plugins, aliases, or completions.
.. warning::
When changing theme, do not use ``bash-it reload``. Instead, use :ref:`restart`.
.. _restart:
Bash-it restart
^^^^^^^^^^^^^^^
Similar to :ref:`reload`, ``bash-it restart`` can be used to restart your shell.
Instead of reloading your Bash profile, this command re-runs Bash (using exec).
This is stronger than simple reload, and is similar to the effect of closing and reopening your terminal.

View File

@@ -8,7 +8,7 @@ Welcome to Bash-it's documentation!
Includes autocompletion, themes, aliases, custom functions, a few stolen pieces from Steve Losh, and more. 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. 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! If you're using the *Bourne Again Shell* (Bash) regularly and have been looking for an easy way on how to keep all of these nice little scripts and aliases under control, then Bash-it is for you!
Stop polluting your ``~/bin`` directory and your ``.bashrc`` file, fork/clone Bash-it and start hacking away. Stop polluting your ``~/bin`` directory and your ``.bashrc`` file, fork/clone Bash-it and start hacking away.
.. toctree:: .. toctree::

14
docs/themes-list/easy.rst Normal file
View File

@@ -0,0 +1,14 @@
.. _easy:
Easy Theme
==========
A simple theme
Examples
--------
.. code-block:: bash
user@hostname ~/.bash_it
[ master ✓ ]

View File

@@ -187,6 +187,22 @@ Doubletime Multiline Python Only
:alt: :alt:
----
Easy
^^^^
.. image:: https://bash-it.github.io/bash-it/docs/images/easy-black.jpg
:target: https://bash-it.github.io/bash-it/docs/images/easy-black.jpg
:alt:
.. image:: https://bash-it.github.io/bash-it/docs/images/easy-white.jpg
:target: https://bash-it.github.io/bash-it/docs/images/easy-white.jpg
:alt:
---- ----
Envy Envy

View File

@@ -70,11 +70,13 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o
* ``battery`` - Battery information (you'll need to enable the ``battery`` plugin) * ``battery`` - Battery information (you'll need to enable the ``battery`` plugin)
* ``clock`` - Current time in ``HH:MM:SS`` format * ``clock`` - Current time in ``HH:MM:SS`` format
* ``cwd`` - Current working directory including full folder hierarchy (c.f. ``wd``\ ) * ``cwd`` - Current working directory including full folder hierarchy (c.f. ``wd``\ )
* ``duration`` - Duration of the last command. See :ref:`Command duration <command_duration>` for details.
* ``gcloud`` - Current gcloud active account * ``gcloud`` - Current gcloud active account
* ``hostname`` - Host name of machine * ``hostname`` - Host name of machine
* ``in_toolbox`` - Show identifier if running inside a `toolbox <https://github.com/containers/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 * ``in_vim`` - Show identifier if running in ``:terminal`` from vim
* ``k8s_context`` - Show current kubernetes context * ``k8s_context`` - Show current kubernetes context
* ``k8s_namespace`` - Show current kubernetes namespace
* ``last_status`` - Exit status of last run command * ``last_status`` - Exit status of last run command
* ``python_venv`` - Python virtual environment information (\ ``virtualenv``\ , ``venv`` * ``python_venv`` - Python virtual environment information (\ ``virtualenv``\ , ``venv``
and ``conda`` supported) and ``conda`` supported)

39
hooks/check-clean-files-txt.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/env bash
file=$1
# Should only be run on clean_files.txt
if [ "$file" != "clean_files.txt" ]; then
echo "Please run this script on clean_files.txt only!"
exit 1
fi
function compare_lines() {
prev=""
while read -r line; do
# Skip unimportant lines
[[ $line =~ "#" ]] && continue
[[ $line == "" ]] && continue
# Actual check
if [[ $prev > $line ]]; then
echo "$line should be before $prev"
exit 1
fi
prev=$line
done <<< "$1"
}
# We compare using the legacy way
shopt -s compat31
# Test root files
compare_lines "$(grep -v "/" "$file")"
# Test root directory
compare_lines "$(grep "/$" "$file")"
# Test non root directories
compare_lines "$(grep "/." "$file")"
shopt -u compat31
# Yay, all good!
exit 0

View File

@@ -171,7 +171,8 @@ while getopts "hsinaf" opt; do
;; ;;
esac esac
done done
shift $(("$OPTIND" - 1))
shift $((OPTIND - 1))
if [[ $silent ]] && [[ $interactive ]]; then if [[ $silent ]] && [[ $interactive ]]; then
echo -e "\033[91mOptions --silent and --interactive are mutually exclusive. Please choose one or the other.\033[m" echo -e "\033[91mOptions --silent and --interactive are mutually exclusive. Please choose one or the other.\033[m"

View File

@@ -203,7 +203,7 @@ _bash-it_pull_and_update_inner() {
_bash-it-migrate _bash-it-migrate
echo "" echo ""
echo "All done, enjoy!" echo "All done, enjoy!"
bash-it reload bash-it restart
else else
echo "Error updating Bash-it, please, check if your Bash-it installation folder (${BASH_IT}) is clean." echo "Error updating Bash-it, please, check if your Bash-it installation folder (${BASH_IT}) is clean."
fi fi
@@ -224,6 +224,9 @@ _bash-it-update-() {
cd "${BASH_IT}" || return cd "${BASH_IT}" || return
DIFF=$(git diff --name-status)
[ -n "$DIFF" ] && echo -e "Local changes detected in bash-it directory. Clean '$BASH_IT' directory to proceed.\n$DIFF" && return 1
if [ -z "$BASH_IT_REMOTE" ]; then if [ -z "$BASH_IT_REMOTE" ]; then
BASH_IT_REMOTE="origin" BASH_IT_REMOTE="origin"
fi fi

View File

@@ -1,3 +1,4 @@
# shellcheck shell=bash
# Load after the other completions to understand what needs to be completed # Load after the other completions to understand what needs to be completed
# BASH_IT_LOAD_PRIORITY: 365 # BASH_IT_LOAD_PRIORITY: 365
@@ -17,54 +18,61 @@ about-plugin 'Automatic completion of aliases'
# Automatically add completion for all aliases to commands having completion functions # Automatically add completion for all aliases to commands having completion functions
function alias_completion { function alias_completion {
local namespace="alias_completion" local namespace="alias_completion"
# parse function based completion definitions, where capture group 2 => function and 3 => trigger # parse function based completion definitions, where capture group 2 => function and 3 => trigger
local compl_regex='complete( +[^ ]+)* -F ([^ ]+) ("[^"]+"|[^ ]+)' local compl_regex='complete( +[^ ]+)* -F ([^ ]+) ("[^"]+"|[^ ]+)'
# parse alias definitions, where capture group 1 => trigger, 2 => command, 3 => command arguments # parse alias definitions, where capture group 1 => trigger, 2 => command, 3 => command arguments
local alias_regex="alias( -- | )([^=]+)='(\"[^\"]+\"|[^ ]+)(( +[^ ]+)*)'" local alias_regex="alias( -- | )([^=]+)='(\"[^\"]+\"|[^ ]+)(( +[^ ]+)*)'"
# create array of function completion triggers, keeping multi-word triggers together # create array of function completion triggers, keeping multi-word triggers together
eval "local completions=($(complete -p | sed -Ene "/$compl_regex/s//'\3'/p"))" eval "local completions=($(complete -p | sed -Ene "/$compl_regex/s//'\3'/p"))"
(( ${#completions[@]} == 0 )) && return 0 ((${#completions[@]} == 0)) && return 0
# create temporary file for wrapper functions and completions # create temporary file for wrapper functions and completions
local tmp_file; tmp_file="$(mktemp -t "${namespace}-${RANDOM}XXXXXX")" || return 1 local tmp_file
tmp_file="$(mktemp -t "${namespace}-${RANDOM}XXXXXX")" || return 1
local completion_loader; completion_loader="$(complete -p -D 2>/dev/null | sed -Ene 's/.* -F ([^ ]*).*/\1/p')" local completion_loader
completion_loader="$(complete -p -D 2> /dev/null | sed -Ene 's/.* -F ([^ ]*).*/\1/p')"
# read in "<alias> '<aliased command>' '<command args>'" lines from defined aliases # read in "<alias> '<aliased command>' '<command args>'" lines from defined aliases
local line; while read line; do local line
eval "local alias_tokens; alias_tokens=($line)" 2>/dev/null || continue # some alias arg patterns cause an eval parse error
local alias_name="${alias_tokens[0]}" alias_cmd="${alias_tokens[1]}" alias_args="${alias_tokens[2]# }"
# skip aliases to pipes, boolean control structures and other command lists # shellcheck disable=SC2162
# (leveraging that eval errs out if $alias_args contains unquoted shell metacharacters) # some aliases do have backslashes that needs to be interpreted
eval "local alias_arg_words; alias_arg_words=($alias_args)" 2>/dev/null || continue while read line; do
# avoid expanding wildcards eval "local alias_tokens; alias_tokens=($line)" 2> /dev/null || continue # some alias arg patterns cause an eval parse error
read -a alias_arg_words <<< "$alias_args" local alias_name="${alias_tokens[0]}" alias_cmd="${alias_tokens[1]}" alias_args="${alias_tokens[2]# }"
# skip alias if there is no completion function triggered by the aliased command # skip aliases to pipes, boolean control structures and other command lists
if [[ ! " ${completions[*]} " =~ " $alias_cmd " ]]; then # (leveraging that eval errs out if $alias_args contains unquoted shell metacharacters)
if [[ -n "$completion_loader" ]]; then eval "local alias_arg_words; alias_arg_words=($alias_args)" 2> /dev/null || continue
# force loading of completions for the aliased command # avoid expanding wildcards
eval "$completion_loader $alias_cmd" read -a alias_arg_words <<< "$alias_args"
# 124 means completion loader was successful
[[ $? -eq 124 ]] || continue
completions+=($alias_cmd)
else
continue
fi
fi
local new_completion="$(complete -p "$alias_cmd" 2>/dev/null)"
# create a wrapper inserting the alias arguments if any # skip alias if there is no completion function triggered by the aliased command
if [[ -n $alias_args ]]; then if ! _bash-it-array-contains-element "$alias_cmd" "${completions[@]}"; then
local compl_func="${new_completion/#* -F /}"; compl_func="${compl_func%% *}" if [[ -n "$completion_loader" ]]; then
# avoid recursive call loops by ignoring our own functions # force loading of completions for the aliased command
if [[ "${compl_func#_$namespace::}" == $compl_func ]]; then eval "$completion_loader $alias_cmd"
local compl_wrapper="_${namespace}::${alias_name}" # 124 means completion loader was successful
echo "function $compl_wrapper { [[ $? -eq 124 ]] || continue
completions+=("$alias_cmd")
else
continue
fi
fi
local new_completion="$(complete -p "$alias_cmd" 2> /dev/null)"
# create a wrapper inserting the alias arguments if any
if [[ -n $alias_args ]]; then
local compl_func="${new_completion/#* -F /}"
compl_func="${compl_func%% *}"
# avoid recursive call loops by ignoring our own functions
if [[ "${compl_func#_$namespace::}" == "$compl_func" ]]; then
local compl_wrapper="_${namespace}::${alias_name}"
echo "function $compl_wrapper {
local compl_word=\$2 local compl_word=\$2
local prec_word=\$3 local prec_word=\$3
# check if prec_word is the alias itself. if so, replace it # check if prec_word is the alias itself. if so, replace it
@@ -81,15 +89,18 @@ function alias_completion {
(( COMP_POINT += \${#COMP_LINE} )) (( COMP_POINT += \${#COMP_LINE} ))
$compl_func \"$alias_cmd\" \"\$compl_word\" \"\$prec_word\" $compl_func \"$alias_cmd\" \"\$compl_word\" \"\$prec_word\"
}" >> "$tmp_file" }" >> "$tmp_file"
new_completion="${new_completion/ -F $compl_func / -F $compl_wrapper }" new_completion="${new_completion/ -F $compl_func / -F $compl_wrapper }"
fi fi
fi fi
# replace completion trigger by alias # replace completion trigger by alias
if [[ -n $new_completion ]]; then if [[ -n $new_completion ]]; then
new_completion="${new_completion% *} $alias_name" new_completion="${new_completion% *} $alias_name"
echo "$new_completion" >> "$tmp_file" echo "$new_completion" >> "$tmp_file"
fi fi
done < <(alias -p | sed -Ene "s/$alias_regex/\2 '\3' '\4'/p") done < <(alias -p | sed -Ene "s/$alias_regex/\2 '\3' '\4'/p")
source "$tmp_file" && command rm -f "$tmp_file" # shellcheck source=/dev/null
}; alias_completion source "$tmp_file" && command rm -f "$tmp_file"
}
alias_completion

View File

@@ -37,7 +37,7 @@ End-Of-Usage
local -r filename=$(basename -- $1) local -r filename=$(basename -- $1)
local -r filedirname=$(dirname -- $1) local -r filedirname=$(dirname -- $1)
local targetdirname=$(sed 's/\(\.tar\.bz2$\|\.tbz$\|\.tbz2$\|\.tar\.gz$\|\.tgz$\|\.tar$\|\.tar\.xz$\|\.txz$\|\.tar\.Z$\|\.7z$\)//g' <<< $filename) local targetdirname=$(sed 's/\(\.tar\.bz2$\|\.tbz$\|\.tbz2$\|\.tar\.gz$\|\.tgz$\|\.tar$\|\.tar\.xz$\|\.txz$\|\.tar\.Z$\|\.7z$\|\.nupkg$\|\.zip$\|\.war$\|\.jar$\)//g' <<< $filename)
if [ "$filename" = "$targetdirname" ]; then if [ "$filename" = "$targetdirname" ]; then
# archive type either not supported or it doesn't need dir creation # archive type either not supported or it doesn't need dir creation
targetdirname="" targetdirname=""
@@ -61,9 +61,9 @@ End-Of-Usage
*.rpm) rpm2cpio "$1" | cpio -idm${verbose} ;; *.rpm) rpm2cpio "$1" | cpio -idm${verbose} ;;
*.tar) tar "x${verbose}f" "$1" -C "$filedirname/$targetdirname" ;; *.tar) tar "x${verbose}f" "$1" -C "$filedirname/$targetdirname" ;;
*.xz) xz --decompress "$1" ;; *.xz) xz --decompress "$1" ;;
*.zip|*.war|*.jar) unzip "$1" ;; *.zip|*.war|*.jar|*.nupkg) unzip "$1" -d "$filedirname/$targetdirname" ;;
*.Z) uncompress "$1" ;; *.Z) uncompress "$1" ;;
*.7z) 7za x "$1" ;; *.7z) 7za x -o"$filedirname/$targetdirname" "$1" ;;
*) echo "'$1' cannot be extracted via extract" >&2;; *) echo "'$1' cannot be extracted via extract" >&2;;
esac esac
fi fi

View File

@@ -121,6 +121,18 @@ function scm {
fi fi
} }
scm_prompt() {
local CHAR=$(scm_char)
local format=${SCM_PROMPT_FORMAT:-'[%s%s]'}
if [[ $CHAR = "$SCM_NONE_CHAR" ]]; then
return
else
# shellcheck disable=2059
printf "$format\n" "$CHAR" "$(scm_prompt_info)"
fi
}
function scm_prompt_char { function scm_prompt_char {
if [[ -z $SCM ]]; then scm; fi if [[ -z $SCM ]]; then scm; fi
if [[ $SCM == "$SCM_GIT" ]]; then if [[ $SCM == "$SCM_GIT" ]]; then
@@ -359,7 +371,9 @@ function hg_prompt_vars {
if [ -f "$HG_ROOT/branch" ]; then if [ -f "$HG_ROOT/branch" ]; then
# Mercurial holds it's current branch in .hg/branch file # Mercurial holds it's current branch in .hg/branch file
SCM_BRANCH=$(cat "$HG_ROOT/branch") SCM_BRANCH=$(< "${HG_ROOT}/branch")
local bookmark=${HG_ROOT}/bookmarks.current
[[ -f ${bookmark} ]] && SCM_BRANCH+=:$(< "${bookmark}")
else else
SCM_BRANCH=$(hg summary 2> /dev/null | grep branch: | awk '{print $2}') SCM_BRANCH=$(hg summary 2> /dev/null | grep branch: | awk '{print $2}')
fi fi
@@ -435,6 +449,10 @@ function k8s_context_prompt {
echo -e "$(kubectl config current-context 2> /dev/null)" echo -e "$(kubectl config current-context 2> /dev/null)"
} }
function k8s_namespace_prompt {
echo -e "$(kubectl config view --minify --output 'jsonpath={..namespace}' 2> /dev/null)"
}
function virtualenv_prompt { function virtualenv_prompt {
if [[ -n "$VIRTUAL_ENV" ]]; then if [[ -n "$VIRTUAL_ENV" ]]; then
virtualenv=$(basename "$VIRTUAL_ENV") virtualenv=$(basename "$VIRTUAL_ENV")

View File

@@ -31,15 +31,6 @@ function set_user_color() {
esac esac
} }
scm_prompt() {
CHAR=$(scm_char)
if [ "$CHAR" = "$SCM_NONE_CHAR" ]; then
return
else
echo "[$(scm_char)$(scm_prompt_info)]"
fi
}
# Define custom colors we need # Define custom colors we need
# non-printable bytes in PS1 need to be contained within \[ \]. # non-printable bytes in PS1 need to be contained within \[ \].
# Otherwise, bash will count them in the length of the prompt # Otherwise, bash will count them in the length of the prompt

View File

@@ -15,16 +15,8 @@ is_vim_shell() {
fi fi
} }
scm_prompt() {
CHAR=$(scm_char)
if [ "$CHAR" = "$SCM_NONE_CHAR" ]; then
return
else
echo " $(scm_char) (${white}$(scm_prompt_info)${normal})"
fi
}
prompt() { prompt() {
SCM_PROMPT_FORMAT=' %s (%s)'
PS1="${white}${background_blue} \u${normal}${background_blue}@${red}${background_blue}\h $(clock_prompt) ${reset_color}${normal} $(battery_charge)\n${bold_black}${background_white} \w ${normal}$(scm_prompt)$(is_vim_shell)\n${white}>${normal} " PS1="${white}${background_blue} \u${normal}${background_blue}@${red}${background_blue}\h $(clock_prompt) ${reset_color}${normal} $(battery_charge)\n${bold_black}${background_white} \w ${normal}$(scm_prompt)$(is_vim_shell)\n${white}>${normal} "
} }

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash # shellcheck shell=bash
function prompt_command() { function prompt_command() {
PS1="${green}\u@\h $(clock_prompt) ${reset_color}${white}\w${reset_color}$(scm_prompt_info)${blue}${bold_blue} ${reset_color} ${normal}"; PS1="${green}\u@\h $(clock_prompt) ${reset_color}${white}\w${reset_color}$(scm_prompt_info)${blue}${bold_blue} ${reset_color} ${normal}"
} }
THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$blue"} THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$blue"}

View File

@@ -3,16 +3,6 @@ SCM_THEME_PROMPT_DIRTY="${bold_red} ✗${normal}"
SCM_THEME_PROMPT_CLEAN="${bold_green}${normal}" SCM_THEME_PROMPT_CLEAN="${bold_green}${normal}"
SCM_GIT_CHAR="${green}±${normal}" SCM_GIT_CHAR="${green}±${normal}"
scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo " [$(scm_char)$(scm_prompt_info)]"
fi
}
mark_prompt() { mark_prompt() {
echo "${green}\$${normal}" echo "${green}\$${normal}"
} }
@@ -25,6 +15,7 @@ user_host_path_prompt() {
} }
prompt() { prompt() {
SCM_PROMPT_FORMAT=' [%s%s]'
PS1="$(user_host_path_prompt)$(virtualenv_prompt)$(scm_prompt) $(mark_prompt) " PS1="$(user_host_path_prompt)$(virtualenv_prompt)$(scm_prompt) $(mark_prompt) "
} }

View File

@@ -28,17 +28,6 @@ else
THEME_PROMPT_HOST_COLOR="$blue" THEME_PROMPT_HOST_COLOR="$blue"
fi fi
doubletime_scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]; then
return
elif [ $CHAR = $SCM_GIT_CHAR ]; then
echo "$(git_prompt_status)"
else
echo "[$(scm_prompt_info)]"
fi
}
function prompt_setter() { function prompt_setter() {
# Save history # Save history
history -a history -a
@@ -46,27 +35,9 @@ function prompt_setter() {
history -r history -r
PS1=" PS1="
$(clock_prompt) $(scm_char) [${THEME_PROMPT_HOST_COLOR}\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(ruby_version_prompt)\w $(clock_prompt) $(scm_char) [${THEME_PROMPT_HOST_COLOR}\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(ruby_version_prompt)\w
$(doubletime_scm_prompt)$reset_color $ " $(scm_prompt)$reset_color $ "
PS2='> ' PS2='> '
PS4='+ ' PS4='+ '
} }
safe_append_prompt_command prompt_setter safe_append_prompt_command prompt_setter
git_prompt_status() {
local git_status_output
git_status_output=$(git status 2> /dev/null )
if [ -n "$(echo $git_status_output | grep 'Changes not staged')" ]; then
git_status="${bold_red}$(scm_prompt_info)"
elif [ -n "$(echo $git_status_output | grep 'Changes to be committed')" ]; then
git_status="${bold_yellow}$(scm_prompt_info) ^"
elif [ -n "$(echo $git_status_output | grep 'Untracked files')" ]; then
git_status="${bold_cyan}$(scm_prompt_info) +"
elif [ -n "$(echo $git_status_output | grep 'nothing to commit')" ]; then
git_status="${bold_green}$(scm_prompt_info) ${green}"
else
git_status="$(scm_prompt_info)"
fi
echo "[$git_status${normal}]"
}

View File

@@ -0,0 +1,19 @@
# shellcheck shell=bash
SCM_THEME_PROMPT_PREFIX="${bold_green}[ ${normal}"
SCM_THEME_PROMPT_SUFFIX="${bold_green} ] "
SCM_THEME_PROMPT_DIRTY=" ${red}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}"
prompt_command() {
if [ "$(whoami)" = root ]; then
cursor_color="${bold_red}"
user_color="${green}"
else
cursor_color="${bold_green}"
user_color="${white}"
fi
PS1="${user_color}\u${normal}@${white}\h ${bold_black}\w\n${reset_color}$(scm_prompt_info)${cursor_color} ${normal}"
}
safe_append_prompt_command prompt_command

View File

@@ -4,26 +4,18 @@ SCM_THEME_PROMPT_SUFFIX=")${normal}"
SCM_THEME_PROMPT_DIRTY="*" SCM_THEME_PROMPT_DIRTY="*"
SCM_THEME_PROMPT_CLEAN="" SCM_THEME_PROMPT_CLEAN=""
SCM_GIT_CHAR="g" SCM_GIT_CHAR="${green}±${normal}"
SCM_SVN_CHAR="s" SCM_SVN_CHAR="${bold_cyan}${normal}"
SCM_HG_CHAR="h" SCM_HG_CHAR="${bold_red}${normal}"
### TODO: openSUSE has already colors enabled, check if those differs from stock ### TODO: openSUSE has already colors enabled, check if those differs from stock
# LS colors, made with http://geoff.greer.fm/lscolors/ # LS colors, made with http://geoff.greer.fm/lscolors/
# export LSCOLORS="Gxfxcxdxbxegedabagacad" # export LSCOLORS="Gxfxcxdxbxegedabagacad"
# 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:' # 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() { gallifrey_prompt() {
CHAR=$(scm_char) SCM_PROMPT_FORMAT='%s%s'
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "$(scm_prompt_info) "
fi
}
pure_prompt() {
ps_host="${green}\h${normal}"; ps_host="${green}\h${normal}";
ps_user_mark="${bold}\$${normal}"; ps_user_mark="${bold}\$${normal}";
ps_root_mark="${normal}§" ps_root_mark="${normal}§"
@@ -38,4 +30,4 @@ pure_prompt() {
esac esac
} }
safe_append_prompt_command pure_prompt safe_append_prompt_command gallifrey_prompt

View File

@@ -69,16 +69,6 @@ is_vim_shell() {
fi fi
} }
modern_scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "[$(scm_char)][$GREEN$(scm_prompt_info)]"
fi
}
# show chroot if exist # show chroot if exist
chroot(){ chroot(){
if [ -n "$debian_chroot" ] if [ -n "$debian_chroot" ]
@@ -99,7 +89,7 @@ my_ve(){
} }
prompt() { prompt() {
SCM_PROMPT_FORMAT="[%s$GREEN%s]"
my_ps_host="$BOLD$ORANGE\h${normal}"; my_ps_host="$BOLD$ORANGE\h${normal}";
# yes, these are the the same for now ... # yes, these are the the same for now ...
my_ps_host_root="$ORANGE\h${normal}"; my_ps_host_root="$ORANGE\h${normal}";
@@ -114,10 +104,10 @@ prompt() {
# nice prompt # nice prompt
case "`id -u`" in case "`id -u`" in
0) PS1="\n${TITLEBAR}${BRACKET_COLOR}┌─${normal}$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${green}\w${normal}]$(is_vim_shell)${BRACKET_COLOR} 0) PS1="\n${TITLEBAR}${BRACKET_COLOR}┌─${normal}$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(scm_prompt)$(__my_rvm_ruby_version)[${green}\w${normal}]$(is_vim_shell)${BRACKET_COLOR}
└─▪ ${prompt_symbol} ${normal}" └─▪ ${prompt_symbol} ${normal}"
;; ;;
*) PS1="\n${TITLEBAR}${BRACKET_COLOR}┌─${normal}$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(modern_scm_prompt)${normal}$(__my_rvm_ruby_version)[${green}\w${normal}]$(is_vim_shell)${BRACKET_COLOR} *) PS1="\n${TITLEBAR}${BRACKET_COLOR}┌─${normal}$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(scm_prompt)${normal}$(__my_rvm_ruby_version)[${green}\w${normal}]$(is_vim_shell)${BRACKET_COLOR}
└─▪ ${prompt_symbol} ${normal}" └─▪ ${prompt_symbol} ${normal}"
;; ;;
esac esac

View File

@@ -32,26 +32,17 @@ is_vim_shell() {
fi fi
} }
modern_scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "[$(scm_char)][$(scm_prompt_info)]"
fi
}
prompt() { prompt() {
SCM_PROMPT_FORMAT='[%s][%s]'
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
# Yes, the indenting on these is weird, but it has to be like # Yes, the indenting on these is weird, but it has to be like
# this otherwise it won't display properly. # this otherwise it won't display properly.
PS1="${TITLEBAR}${bold_red}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]${reset_color}$(modern_scm_prompt)[${cyan}\W${normal}]$(is_vim_shell) PS1="${TITLEBAR}${bold_red}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]${reset_color}$(scm_prompt)[${cyan}\W${normal}]$(is_vim_shell)
${bold_red}└─▪${normal} " ${bold_red}└─▪${normal} "
else else
PS1="${TITLEBAR}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]$(modern_scm_prompt)[${cyan}\W${normal}]$(is_vim_shell) PS1="${TITLEBAR}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]$(scm_prompt)[${cyan}\W${normal}]$(is_vim_shell)
└─▪ " └─▪ "
fi fi
} }

View File

@@ -28,30 +28,21 @@ is_vim_shell() {
fi fi
} }
modern_scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "[$(scm_char)][$(scm_prompt_info)]"
fi
}
modern_current_time_prompt() { modern_current_time_prompt() {
echo "[$(date '+%l:%M%p')]" echo "[$(date '+%l:%M%p')]"
} }
prompt() { prompt() {
SCM_PROMPT_FORMAT='[%s][%s]'
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
# Yes, the indenting on these is weird, but it has to be like # Yes, the indenting on these is weird, but it has to be like
# this otherwise it won't display properly. # this otherwise it won't display properly.
PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(modern_scm_prompt)$(modern_current_time_prompt)[${cyan}\W${normal}]$(is_vim_shell) PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(scm_prompt)$(modern_current_time_prompt)[${cyan}\W${normal}]$(is_vim_shell)
${bold_red}└─▪${normal} " ${bold_red}└─▪${normal} "
else else
PS1="${TITLEBAR}┌─$(modern_scm_prompt)$(modern_current_time_prompt)[${cyan}\W${normal}]$(is_vim_shell) PS1="${TITLEBAR}┌─$(scm_prompt)$(modern_current_time_prompt)[${cyan}\W${normal}]$(is_vim_shell)
└─▪ " └─▪ "
fi fi
} }

View File

@@ -26,15 +26,6 @@ is_vim_shell() {
fi fi
} }
modern_scm_prompt() {
CHAR=$(scm_char)
if [ "$CHAR" = "$SCM_NONE_CHAR" ]; then
return
else
echo "[$(scm_char)][$(scm_prompt_info)]"
fi
}
detect_venv() { detect_venv() {
python_venv="" python_venv=""
# Detect python venv # Detect python venv
@@ -46,11 +37,12 @@ detect_venv() {
} }
prompt() { prompt() {
SCM_PROMPT_FORMAT='[%s][%s]'
retval=$? retval=$?
if [[ retval -ne 0 ]]; then if [[ retval -ne 0 ]]; then
PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(modern_scm_prompt)[${cyan}\u${normal}][${cyan}\w${normal}]$(is_vim_shell)\n${bold_red}└─▪${normal} " PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(scm_prompt)[${cyan}\u${normal}][${cyan}\w${normal}]$(is_vim_shell)\n${bold_red}└─▪${normal} "
else else
PS1="${TITLEBAR}┌─$(modern_scm_prompt)[${cyan}\u${normal}][${cyan}\w${normal}]$(is_vim_shell)\n└─▪ " PS1="${TITLEBAR}┌─$(scm_prompt)[${cyan}\u${normal}][${cyan}\w${normal}]$(is_vim_shell)\n└─▪ "
fi fi
detect_venv detect_venv
PS1+="${python_venv}${dir_color}" PS1+="${python_venv}${dir_color}"

View File

@@ -55,6 +55,9 @@ TERRAFORM_CHAR=${POWERLINE_TERRAFORM_CHAR:="t "}
KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "} KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "}
KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26} KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26}
KUBERNETES_NAMESPACE_THEME_CHAR=${POWERLINE_KUBERNETES_NAMESPACE_CHAR:="⎈ "}
KUBERNETES_NAMESPACE_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_NAMESPACE_COLOR:=64}
AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="aws "} AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="aws "}
AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208} AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208}
@@ -94,6 +97,8 @@ COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"}
GCLOUD_THEME_PROMPT_COLOR=${POWERLINE_GCLOUD_COLOR:=161} GCLOUD_THEME_PROMPT_COLOR=${POWERLINE_GCLOUD_COLOR:=161}
GCLOUD_CHAR=${POWERLINE_GCLOUD_CHAR:="G "} GCLOUD_CHAR=${POWERLINE_GCLOUD_CHAR:="G "}
COMMAND_DURATION_PROMPT_COLOR=${POWERLINE_COMMAND_DURATION_COLOR:=129}
POWERLINE_LEFT_PROMPT=${POWERLINE_LEFT_PROMPT:="scm python_venv ruby node cwd"} POWERLINE_LEFT_PROMPT=${POWERLINE_LEFT_PROMPT:="scm python_venv ruby node cwd"}
POWERLINE_RIGHT_PROMPT=${POWERLINE_RIGHT_PROMPT:="in_vim clock battery user_info"} POWERLINE_RIGHT_PROMPT=${POWERLINE_RIGHT_PROMPT:="in_vim clock battery user_info"}

View File

@@ -50,6 +50,9 @@ TERRAFORM_CHAR=${POWERLINE_TERRAFORM_CHAR:="t "}
KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "} KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "}
KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26} KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26}
KUBERNETES_NAMESPACE_THEME_CHAR=${POWERLINE_KUBERNETES_NAMESPACE_CHAR:="⎈ "}
KUBERNETES_NAMESPACE_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_NAMESPACE_COLOR:=64}
AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="aws "} AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="aws "}
AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208} AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208}

View File

@@ -47,6 +47,9 @@ TERRAFORM_CHAR=${POWERLINE_TERRAFORM_CHAR:="t "}
KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "} KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "}
KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26} KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26}
KUBERNETES_NAMESPACE_THEME_CHAR=${POWERLINE_KUBERNETES_NAMESPACE_CHAR:="⎈ "}
KUBERNETES_NAMESPACE_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_NAMESPACE_COLOR:=60}
AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="aws "} AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="aws "}
AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208} AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208}

View File

@@ -85,6 +85,16 @@ function __powerline_k8s_context_prompt() {
[[ -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_k8s_namespace_prompt() {
local kubernetes_namespace=""
if _command_exists kubectl; then
kubernetes_namespace="$(k8s_namespace_prompt)"
fi
[[ -n "${kubernetes_namespace}" ]] && echo "${KUBERNETES_NAMESPACE_THEME_CHAR}${kubernetes_namespace}|${KUBERNETES_NAMESPACE_THEME_PROMPT_COLOR}"
}
function __powerline_python_venv_prompt() { function __powerline_python_venv_prompt() {
set +u set +u
local python_venv="" local python_venv=""
@@ -210,6 +220,11 @@ function __powerline_command_number_prompt() {
echo "${COMMAND_NUMBER_THEME_PROMPT_CHAR}\#|${COMMAND_NUMBER_THEME_PROMPT_COLOR}" echo "${COMMAND_NUMBER_THEME_PROMPT_CHAR}\#|${COMMAND_NUMBER_THEME_PROMPT_COLOR}"
} }
function __powerline_duration_prompt() {
local duration=$(_command_duration)
[[ -n "$duration" ]] && echo "${duration}|${COMMAND_DURATION_PROMPT_COLOR}"
}
function __powerline_left_segment() { function __powerline_left_segment() {
local params local params
IFS="|" read -ra params <<< "${1}" IFS="|" read -ra params <<< "${1}"

View File

@@ -52,6 +52,9 @@ TERRAFORM_CHAR=${POWERLINE_TERRAFORM_CHAR:="t "}
KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "} KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "}
KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26} KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26}
KUBERNETES_NAMESPACE_THEME_CHAR=${POWERLINE_KUBERNETES_NAMESPACE_CHAR:="⎈ "}
KUBERNETES_NAMESPACE_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_NAMESPACE_COLOR:=64}
AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="aws "} AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="aws "}
AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208} AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208}
@@ -91,6 +94,8 @@ COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"}
GCLOUD_THEME_PROMPT_COLOR=${POWERLINE_GCLOUD_COLOR:=161} GCLOUD_THEME_PROMPT_COLOR=${POWERLINE_GCLOUD_COLOR:=161}
GCLOUD_CHAR=${POWERLINE_GCLOUD_CHAR:="G "} GCLOUD_CHAR=${POWERLINE_GCLOUD_CHAR:="G "}
COMMAND_DURATION_PROMPT_COLOR=${POWERLINE_COMMAND_DURATION_COLOR:=129}
POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby node cwd"} POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby node cwd"}
safe_append_prompt_command __powerline_prompt_command safe_append_prompt_command __powerline_prompt_command

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
# scm theming # scm theming
SCM_THEME_PROMPT_PREFIX="|" SCM_THEME_PROMPT_PREFIX="|"
SCM_THEME_PROMPT_SUFFIX="" SCM_THEME_PROMPT_SUFFIX=""
@@ -16,31 +18,22 @@ VIRTUALENV_THEME_PROMPT_SUFFIX=")"
# export LSCOLORS="Gxfxcxdxbxegedabagacad" # export LSCOLORS="Gxfxcxdxbxegedabagacad"
# 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:' # 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
return
else
echo "[$(scm_char)$(scm_prompt_info)]"
fi
}
pure_prompt() { pure_prompt() {
ps_host="${bold_blue}\h${normal}"; ps_host="${bold_blue}\h${normal}"
ps_user="${green}\u${normal}"; ps_user="${green}\u${normal}"
ps_user_mark="${green} $ ${normal}"; ps_user_mark="${green} $ ${normal}"
ps_root="${red}\u${red}"; ps_root="${red}\u${red}"
ps_root_mark="${red} # ${normal}" ps_root_mark="${red} # ${normal}"
ps_path="${yellow}\w${normal}"; ps_path="${yellow}\w${normal}"
# make it work
# make it work case $(id -u) in
case $(id -u) in 0)
0) PS1="$(virtualenv_prompt)$ps_root@$ps_host$(scm_prompt):$ps_path$ps_root_mark" PS1="$(virtualenv_prompt)$ps_root@$ps_host$(scm_prompt):$ps_path$ps_root_mark"
;; ;;
*) PS1="$(virtualenv_prompt)$ps_user@$ps_host$(scm_prompt):$ps_path$ps_user_mark" *)
;; PS1="$(virtualenv_prompt)$ps_user@$ps_host$(scm_prompt):$ps_path$ps_user_mark"
esac ;;
esac
} }
safe_append_prompt_command pure_prompt safe_append_prompt_command pure_prompt

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash # shellcheck shell=bash
SCM_THEME_PROMPT_DIRTY=" ${bold_red}${normal}" SCM_THEME_PROMPT_DIRTY=" ${bold_red}${normal}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}${normal}" SCM_THEME_PROMPT_CLEAN=" ${bold_green}${normal}"
@@ -14,9 +14,21 @@ STATUS_THEME_PROMPT_BAD="${bold_red}${reset_color}${normal} "
STATUS_THEME_PROMPT_OK="${bold_green}${reset_color}${normal} " STATUS_THEME_PROMPT_OK="${bold_green}${reset_color}${normal} "
PURITY_THEME_PROMPT_COLOR="${PURITY_THEME_PROMPT_COLOR:=$blue}" PURITY_THEME_PROMPT_COLOR="${PURITY_THEME_PROMPT_COLOR:=$blue}"
venv_prompt() {
python_venv=""
# Detect python venv
if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then
python_venv="($PYTHON_VENV_CHAR${CONDA_DEFAULT_ENV}) "
elif [[ -n "${VIRTUAL_ENV}" ]]; then
python_venv="($PYTHON_VENV_CHAR$(basename "${VIRTUAL_ENV}")) "
fi
[[ -n "${python_venv}" ]] && echo "${python_venv}"
}
function prompt_command() { function prompt_command() {
local ret_status="$( [ $? -eq 0 ] && echo -e "$STATUS_THEME_PROMPT_OK" || echo -e "$STATUS_THEME_PROMPT_BAD")" retval=$?
PS1="\n${PURITY_THEME_PROMPT_COLOR}\w $(scm_prompt_info)\n${ret_status} " local ret_status="$([ $retval -eq 0 ] && echo -e "$STATUS_THEME_PROMPT_OK" || echo -e "$STATUS_THEME_PROMPT_BAD")"
PS1="\n${PURITY_THEME_PROMPT_COLOR}\w $(scm_prompt_info)\n${ret_status}$(venv_prompt)"
} }
safe_append_prompt_command prompt_command safe_append_prompt_command prompt_command

View File

@@ -36,16 +36,6 @@ is_vim_shell() {
fi fi
} }
modern_scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "[$(scm_char)][$(scm_prompt_info)]"
fi
}
# show chroot if exist # show chroot if exist
chroot(){ chroot(){
if [ -n "$debian_chroot" ] if [ -n "$debian_chroot" ]
@@ -71,7 +61,7 @@ my_ve(){
} }
prompt() { prompt() {
SCM_PROMPT_FORMAT='[%s][%s]'
my_ps_host="${green}\h${normal}"; my_ps_host="${green}\h${normal}";
# yes, these are the the same for now ... # yes, these are the the same for now ...
my_ps_host_root="${green}\h${normal}"; my_ps_host_root="${green}\h${normal}";
@@ -86,10 +76,10 @@ prompt() {
# nice prompt # nice prompt
case "`id -u`" in case "`id -u`" in
0) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}] 0) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]
" "
;; ;;
*) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version) *) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(scm_prompt)$(__my_rvm_ruby_version)
|─[${bold_purple}\w${normal}] |─[${bold_purple}\w${normal}]
" "
;; ;;

View File

@@ -57,16 +57,6 @@ todo_txt_count() {
fi fi
} }
modern_scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "${BRACKET_COLOR}[${CHAR}${BRACKET_COLOR}][${STRING_COLOR}$(scm_prompt_info)${BRACKET_COLOR}]$normal"
fi
}
my_prompt_char() { my_prompt_char() {
if [[ $OSTYPE =~ "darwin" ]]; then if [[ $OSTYPE =~ "darwin" ]]; then
echo "${BRACKET_COLOR}${normal}" echo "${BRACKET_COLOR}${normal}"
@@ -76,6 +66,7 @@ my_prompt_char() {
} }
prompt() { prompt() {
SCM_PROMPT_FORMAT="${BRACKET_COLOR}[%s${BRACKET_COLOR}][${STRING_COLOR}%s${BRACKET_COLOR}]"
my_ps_host="${STRING_COLOR}\h${normal}"; my_ps_host="${STRING_COLOR}\h${normal}";
my_ps_user="${STRING_COLOR}\u${normal}"; my_ps_user="${STRING_COLOR}\u${normal}";
@@ -84,10 +75,10 @@ prompt() {
# nice prompt # nice prompt
case "`id -u`" in case "`id -u`" in
0) PS1="${TITLEBAR}${BRACKET_COLOR}┌─[$my_ps_root${BRACKET_COLOR}][$my_ps_host${BRACKET_COLOR}]$(modern_scm_prompt)$(__my_rvm_ruby_version)${BRACKET_COLOR}[${STRING_COLOR}\w${BRACKET_COLOR}]$(is_vim_shell) 0) PS1="${TITLEBAR}${BRACKET_COLOR}┌─[$my_ps_root${BRACKET_COLOR}][$my_ps_host${BRACKET_COLOR}]$(scm_prompt)$(__my_rvm_ruby_version)${BRACKET_COLOR}[${STRING_COLOR}\w${BRACKET_COLOR}]$(is_vim_shell)
${BRACKET_COLOR}└─$(my_prompt_char)${normal}" ${BRACKET_COLOR}└─$(my_prompt_char)${normal}"
;; ;;
*) PS1="${TITLEBAR}${BRACKET_COLOR}┌─[$my_ps_user${BRACKET_COLOR}][$my_ps_host${BRACKET_COLOR}]$(modern_scm_prompt)$(__my_rvm_ruby_version)${BRACKET_COLOR}[${STRING_COLOR}\w${BRACKET_COLOR}]$(is_vim_shell) *) PS1="${TITLEBAR}${BRACKET_COLOR}┌─[$my_ps_user${BRACKET_COLOR}][$my_ps_host${BRACKET_COLOR}]$(scm_prompt)$(__my_rvm_ruby_version)${BRACKET_COLOR}[${STRING_COLOR}\w${BRACKET_COLOR}]$(is_vim_shell)
${BRACKET_COLOR}└─$(todo_txt_count)$(my_prompt_char)" ${BRACKET_COLOR}└─$(todo_txt_count)$(my_prompt_char)"
;; ;;
esac esac

View File

@@ -43,18 +43,8 @@ is_vim_shell() {
fi fi
} }
modern_scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "[$(scm_char)][$(scm_prompt_info)]"
fi
}
prompt() { prompt() {
SCM_PROMPT_FORMAT='[%s][%s]'
case $HOSTNAME in case $HOSTNAME in
"clappy"* ) my_ps_host="${green}\h${normal}"; "clappy"* ) my_ps_host="${green}\h${normal}";
;; ;;
@@ -70,10 +60,10 @@ prompt() {
# nice prompt # nice prompt
case "`id -u`" in case "`id -u`" in
0) PS1="${TITLEBAR}[$my_ps_root][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) 0) PS1="${TITLEBAR}[$my_ps_root][$my_ps_host]$(scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell)
$ " $ "
;; ;;
*) PS1="${TITLEBAR}[$my_ps_user][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)$(__my_venv_prompt)[${cyan}\w${normal}]$(is_vim_shell) *) PS1="${TITLEBAR}[$my_ps_user][$my_ps_host]$(scm_prompt)$(__my_rvm_ruby_version)$(__my_venv_prompt)[${cyan}\w${normal}]$(is_vim_shell)
$ " $ "
;; ;;
esac esac

View File

@@ -36,16 +36,6 @@ is_vim_shell() {
fi fi
} }
modern_scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "[$(scm_char)][$(scm_prompt_info)]"
fi
}
# show chroot if exist # show chroot if exist
chroot(){ chroot(){
if [ -n "$debian_chroot" ] if [ -n "$debian_chroot" ]
@@ -71,7 +61,7 @@ my_ve(){
} }
prompt() { prompt() {
SCM_PROMPT_FORMAT='[%s][%s]'
my_ps_host="${green}\h${normal}"; my_ps_host="${green}\h${normal}";
# yes, these are the the same for now ... # yes, these are the the same for now ...
my_ps_host_root="${green}\h${normal}"; my_ps_host_root="${green}\h${normal}";
@@ -86,10 +76,10 @@ prompt() {
# nice prompt # nice prompt
case "`id -u`" in case "`id -u`" in
0) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) 0) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell)
└─▪ " └─▪ "
;; ;;
*) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) *) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell)
└─▪ " └─▪ "
;; ;;
esac esac

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Raphael Parree
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,37 @@
jboss-bash-completion
=====================
JBoss Bash Completion for JBoss 5 and 7 (EAP 6)
Overview
--------
Completion for the `run.sh` (JBoss5) and `standalone.sh`/`domain.sh`
Some of the options available in jboss7:
* `--admin-only` `-h` `-help` `-version` `-V` `-v`
* `-Djboss.home.dir`
* `--server-config` (options the xml files in the configuration directory relative to -Djboss.server.base.dir)
* `-b` `-bmanagement` `-bunsecure` `-bpublic` `-Djboss.domain.master.address` `-Djboss.bind.address.*` (options: your local IP addresses and 0.0.0.0)
* `-Djboss.socket.binding.port-offset` (options: 100 200 300 400 10000 20000 30000 40000)
* `-u` (options 239.255.0.1 239.255.0.2 239.255.0.3)
* `-P` -Djboss.node.name
Install
-------
Make sure you have installed bash_completion 1.3 (or higher):
Debian/Ubuntu: `apt-get install bash-completion`
RHEL/CentOS: `yum install bash-completion`
Copy the file(s) to your `/etc/bash_completion.d` folder:
`sudo cp jboss* /etc/bash_completion.d`

95
vendor/github.com/rparree/jboss-bash-completion/jboss5 generated vendored Normal file
View File

@@ -0,0 +1,95 @@
# Completions for JBoss Application Server 5
# VERSION: 1.3
# DATE: 2012-06-21
# rparree-at-edc4it-dot-com
_serverProfiles5(){
# from http://unix.stackexchange.com/questions/34238/complete-files-from-a-different-directory-in-bash
if [ -d "../server" ]
then
IFS=$'\n' tmp=( $(compgen -W "$(ls "../server")" -- "$cur" ))
COMPREPLY=( "${tmp[@]// /\ }" )
unset IFS
else
COMPREPLY=( $(compgen -W "default standard all web minimal production" -- ${cur}) )
fi
}
_bindingAddress5(){
# from /etc/bash_completion.d/ssh
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
"0.0.0.0 $( PATH="$PATH:/sbin" ifconfig -a | \
sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' \
-ne 's/.*inet[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' )" \
-- "$cur" ) )
}
_jboss5()
{
local cur prev words cword
COMPREPLY=()
_get_comp_words_by_ref -n = cur prev words cword
case $cur in
-Djboss.service.binding.set=*)
cur=${cur#*=}
#static list of common bindings sets
local bindings="ports-01 ports-02 ports-03 ports-04"
COMPREPLY=( $(compgen -W "${bindings}" -- ${cur}) )
return 0
;;
-Djboss.default.jgroups.stack=*)
cur=${cur#*=}
#static list of standard JGroups stacks
local stacks="udp udp-async udp-sync tcp tcp-sync"
COMPREPLY=( $(compgen -W "${stacks}" -- ${cur}) )
return 0
;;
-Dorg.jboss.ejb3.remoting.IsLocalInterceptor.passByRef=*|-Dcom.sun.management.jmxremote.authenticate=*|-Dcom.sun.management.jmxremote.ssl=*)
cur=${cur#*=}
local booleans="true false"
COMPREPLY=( $(compgen -W "${booleans}" -- ${cur}) )
return 0
;;
esac
case $prev in
-u)
# a few from RFC 2365 IPv4 Local Scope ()
local addresses="239.255.0.1 239.255.0.2 239.255.0.3"
COMPREPLY=( $(compgen -W "${addresses}" -- ${cur}) )
return 0
;;
-l)
local loggers="log4j jdk"
COMPREPLY=( $(compgen -W "${loggers}" -- ${cur}) )
return 0
;;
-b)
_bindingAddress5
return 0
;;
-c)
_serverProfiles5
return 0
;;
*)
;;
esac
COMPREPLY=( $( compgen -W ' -u -c -m - -b -g -l -d -p -n -B -L -C -P -v -help -Djboss.platform.mbeanserver' -- "$cur" ) \
$( compgen -W '-Djboss.Domain -Djboss.modcluster.proxyList -Djboss.service.binding.set -Djboss.jvmRoute -Djboss.messaging.ServerPeerID -Djboss.default.jgroups.stack -Dorg.jboss.ejb3.remoting.IsLocalInterceptor.passByRef -Djboss.platform.mbeanserver -Dcom.sun.management.jmxremote.port -Dcom.sun.management.jmxremote.ssl' \
-S '=' -- "$cur" ) )
return 0
}
complete -o nospace -F _jboss5 run.sh

141
vendor/github.com/rparree/jboss-bash-completion/jboss7 generated vendored Normal file
View File

@@ -0,0 +1,141 @@
# Completions for JBoss Application Server 7 (EAP 6)
# VERSION: 0.6
# DATE: 2012-10-30
# rparree-at-edc4it-dot-com
_serverProfiles(){
if [[ $COMP_WORDS == *standalone.sh* ]]
then
serverdir="../standalone/configuration/"
else
# assume is domain.sh
serverdir="../domain/configuration/"
fi
for i in ${!COMP_WORDS[*]}
do
if [[ "${COMP_WORDS[i]}" == "-Djboss.server.base.dir" || "${COMP_WORDS[i]}" == "-Djboss.domain.base.dir" ]]; then
serverdir="${COMP_WORDS[i+2]}/configuration"
fi
done
if [ -d "${serverdir}" ]
then
IFS=$'\n' tmp="$(ls "${serverdir}" | grep xml)"
local fls="${tmp[@]// /\ }"
unset IFS
COMPREPLY=( $(compgen -W "${fls} initial boot last v" -- "$cur" ))
fi
}
_bindingAddress(){
# from /etc/bash_completion.d/ssh
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
"0.0.0.0 $( PATH="$PATH:/sbin" ifconfig -a | \
sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' \
-ne 's/.*inet[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' )" \
-- "$cur" ) )
}
_jboss(){
local cur prev words cword
COMPREPLY=()
_get_comp_words_by_ref -n = cur prev words cword
case $cur in
-Djboss.socket.binding.port-offset=*)
cur=${cur#*=}
#static list of common bindings sets
local bindings="100 200 300 400 10000 20000 30000 40000"
COMPREPLY=( $(compgen -W "${bindings}" -- ${cur}) )
return 0
;;
-Djboss.default.jgroups.stack=*)
cur=${cur#*=}
#static list of standard JGroups stacks
local stacks="udp udp-async udp-sync tcp tcp-sync"
COMPREPLY=( $(compgen -W "${stacks}" -- ${cur}) )
return 0
;;
-Dorg.jboss.ejb3.remoting.IsLocalInterceptor.passByRef=*|-Dcom.sun.management.jmxremote.authenticate=*|-Dcom.sun.management.jmxremote.ssl=*)
cur=${cur#*=}
local booleans="true false"
COMPREPLY=( $(compgen -W "${booleans}" -- ${cur}) )
return 0
;;
-Djboss.server.base.dir=*|-Djboss.home.dir=*|-Djboss.domain.base.dir=*)
cur=${cur#*=}
_filedir -d
return 0
;;
-Djboss.domain.master.address=*|-Djboss.bind.address*=*)
cur=${cur#*=}
_bindingAddress
return 0
;;
--server-config=*|-c=|--host-config=*)
cur=${cur#*=}
_serverProfiles
return 0
esac
case $prev in
-u)
# a few from RFC 2365 IPv4 Local Scope ()
local addresses="239.255.0.1 239.255.0.2 239.255.0.3"
COMPREPLY=( $(compgen -W "${addresses}" -- ${cur}) )
return 0
;;
-b*)
_bindingAddress
return 0
;;
-c)
_serverProfiles
return 0
;;
*)
;;
esac
# *** from jboss5 ********************
# *** -modulepath -c -m -g -l -d -p -n -B -L -C -Djboss.platform.mbeanserver -Djboss.server.base.directory
# *** -Djboss.Domain -Djboss.modcluster.proxyList -Djboss.jvmRoute -Djboss.default.jgroups.stack -Dorg.jboss.ejb3.remoting.IsLocalInterceptor.passByRef -Djboss.platform.mbeanserver -Dcom.sun.management.jmxremote.port -Dcom.sun.management.jmxremote.ssl
# *************************************
# standard commands for standalone and domain mode
local commandsWithoutEqualSign='-b -bmanagement -bunsecure -bpublic --admin-only -h -help -u -version -V -v'
local commandsWithEqualSign='-P -Djboss.node.name -Djboss.home.dir -Djboss.socket.binding.port-offset -Djboss.bind.address.management -Djboss.bind.address -Djboss.bind.address.unsecure'
if [[ $COMP_WORDS == *standalone.sh* ]]
then
commandsWithoutEqualSign="${commandsWithoutEqualSign} -c"
commandsWithEqualSign="${commandsWithEqualSign} --server-config -Djboss.server.base.dir -c"
else
# assume is domain.sh
commandsWithoutEqualSign="${commandsWithoutEqualSign} --backup --cached-dc"
commandsWithEqualSign="${commandsWithEqualSign} -Djboss.domain.master.address --host-config -Djboss.domain.master.port -Djboss.domain.base.dir "
fi
COMPREPLY=( $( compgen -W "$commandsWithoutEqualSign" -- "$cur" )
$( compgen -W "$commandsWithEqualSign" -S '=' -- "$cur" ) )
return 0
}
complete -o nospace -F _jboss standalone.sh
complete -o nospace -F _jboss domain.sh