41 Commits

Author SHA1 Message Date
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
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
Noah Gorny
eced6802d0 Merge pull request #1856 from NoahGorny/fix-typeset-command-not-found
helpers: Fix broken compoure references after vendor change
2021-03-22 21:40:29 +02:00
Noah Gorny
02f6654841 test: Add bash-it help plugins test 2021-03-21 22:07:24 +02:00
Noah Gorny
7b5f758eba helpers: Fix broken compoure references after vendor change 2021-03-21 21:52:47 +02: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
Noah Gorny
6f02b8d194 Merge pull request #1851 from ofirshtrull/master
Add support for active gcloud account in powerline prompt
2021-03-15 23:01:43 +02:00
Noah Gorny
c8ef6c9146 Merge pull request #1848 from matthewadams/master
add npm alias nt="npm test"
2021-03-13 18:55:02 +02:00
Ofir Shtrull
8ae2b1e73d fix typo 2021-03-11 18:32:10 +02:00
Ofir Shtrull
ffc1701c0a Add to prompt google gcloud active account 2021-03-11 18:25:23 +02:00
tiago
682d6d728d added python's virtualenv name 2021-03-10 15:24:32 +00:00
Matthew Adams
96586dd575 add alias nt="npm test" 2021-03-09 14:14:19 -06:00
Noah Gorny
c59886b8ab Merge pull request #1847 from tbhaxor/patch-2
Added alias for git rebase
2021-03-09 00:15:58 +02:00
Gurkirat Singh
5c6306deb7 alias (improvement): continue rebase after conflict resolve 2021-03-09 02:24:12 +05:30
Noah Gorny
6093ecbb60 Merge pull request #1841 from ddaza/master
fix: Git alias quote style broke functionality
2021-02-26 10:17:01 +02:00
ddaza
e289549a50 fix alias quotes 2021-02-25 19:45:59 -06:00
Artem Kovalov
9d7738d14d Improved systemd aliases
Refactor naming
Add restart
2021-02-25 00:01:38 +02:00
Noah Gorny
7827907154 Merge pull request #1838 from bialad/patch-1
Remove deprecated kubectl run --generator
2021-02-24 19:06:55 +02:00
Tobias Månsson
0ed6f045f6 Remove deprecated kubectl run --generator
It now defaults to pod, so the --generator option is not required.
2021-02-15 07:41:39 +01: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
25 changed files with 174 additions and 19 deletions

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

@@ -84,7 +84,7 @@ alias glsum='git diff --name-only --diff-filter=U' # Show unmerged (conflicted)
alias ggui='git gui' alias ggui='git gui'
# home # home
alias ghm='cd '\''$(git rev-parse --show-toplevel)'\''' # Git home alias ghm='cd "$(git rev-parse --show-toplevel)"' # Git home
# appendage to ghm # appendage to ghm
if ! _command_exists gh; then if ! _command_exists gh; then
alias gh='ghm' alias gh='ghm'
@@ -127,6 +127,7 @@ alias grm='git rm'
# rebase # rebase
alias grb='git rebase' alias grb='git rebase'
alias grbc='git rebase --continue'
alias grm='git rebase master' alias grm='git rebase master'
alias grmi='git rebase master -i' alias grmi='git rebase master -i'
alias gprom='git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master' # Rebase with latest remote master alias gprom='git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master' # Rebase with latest remote master

View File

@@ -18,7 +18,7 @@ function _set_pkg_aliases()
alias kcgpan='kubectl get pods --all-namespaces' alias kcgpan='kubectl get pods --all-namespaces'
alias kcgdan='kubectl get deployments --all-namespaces' alias kcgdan='kubectl get deployments --all-namespaces'
# launches a disposable netshoot pod in the k8s cluster # launches a disposable netshoot pod in the k8s cluster
alias kcnetshoot='kubectl run --generator=run-pod/v1 netshoot-$(date +%s) --rm -i --tty --image nicolaka/netshoot -- /bin/bash' alias kcnetshoot='kubectl run netshoot-$(date +%s) --rm -i --tty --image nicolaka/netshoot -- /bin/bash'
fi fi
} }

View File

@@ -22,6 +22,7 @@ alias nud='npm update'
alias nr='npm run' alias nr='npm run'
alias nls='npm list --depth=0 2>/dev/null' alias nls='npm list --depth=0 2>/dev/null'
alias nlsg='npm list -g --depth=0 2>/dev/null' alias nlsg='npm list -g --depth=0 2>/dev/null'
alias nt='npm test'
# npx # npx
alias nx='npx' alias nx='npx'

View File

@@ -3,13 +3,20 @@ about-alias 'systemd service'
case $OSTYPE in case $OSTYPE in
linux*) linux*)
# Improve aliases by bringing the common root `sc|scd` + `sre` for action + `u` for user
alias sc='systemctl' alias sc='systemctl'
alias scr='systemctl daemon-reload'
alias scu='systemctl --user' alias scu='systemctl --user'
alias scur='systemctl --user daemon-reload' alias scdr='systemctl daemon-reload'
alias scdru='systemctl --user daemon-reload'
alias scr='systemctl restart'
alias scru='systemctl --user restart'
alias sce='systemctl stop' alias sce='systemctl stop'
alias scue='systemctl --user stop' alias sceu='systemctl --user stop'
alias scs='systemctl start' alias scs='systemctl start'
alias scus='systemctl --user start' alias scsu='systemctl --user start'
# Keeping previous aliases for a non-breaking change.
alias scue='sceu'
alias scus='scsu'
alias scur='scdru'
;; ;;
esac esac

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

@@ -43,7 +43,9 @@ themes/bobby-python
themes/brainy themes/brainy
themes/brunton themes/brunton
themes/command_duration.theme.bash themes/command_duration.theme.bash
themes/easy
themes/modern themes/modern
themes/purity
# plugins # plugins
# #
@@ -82,6 +84,7 @@ 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/notify-send.completion.bash completion/available/notify-send.completion.bash
completion/available/ngrok.completion.bash
completion/available/npm.completion.bash completion/available/npm.completion.bash
completion/available/packer.completion.bash completion/available/packer.completion.bash
completion/available/pip.completion.bash completion/available/pip.completion.bash

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

@@ -9,7 +9,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)
@@ -55,4 +55,8 @@ please feel free to read through this page if you're interested in how Bash-it l
* [List of contributors][contribute] * [List of contributors][contribute]
## License
Bash-it is licensed under the [MIT License](https://github.com/Bash-it/bash-it/blob/master/LICENSE).
[contribute]: https://github.com/Bash-it/bash-it/contributors [contribute]: https://github.com/Bash-it/bash-it/contributors

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,6 +70,7 @@ 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``\ )
* ``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

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

@@ -742,14 +742,14 @@ _help-plugins()
printf '%s' 'please wait, building help...' printf '%s' 'please wait, building help...'
typeset grouplist=$(mktemp -t grouplist.XXXXXX) typeset grouplist=$(mktemp -t grouplist.XXXXXX)
typeset func typeset func
for func in $(typeset_functions) for func in $(_typeset_functions)
do do
typeset group="$(typeset -f $func | metafor group)" typeset group="$(typeset -f $func | metafor group)"
if [ -z "$group" ]; then if [ -z "$group" ]; then
group='misc' group='misc'
fi fi
typeset about="$(typeset -f $func | metafor about)" typeset about="$(typeset -f $func | metafor about)"
letterpress "$about" $func >> $grouplist.$group _letterpress "$about" $func >> $grouplist.$group
echo $grouplist.$group >> $grouplist echo $grouplist.$group >> $grouplist
done done
# clear progress message # clear progress message
@@ -788,7 +788,7 @@ all_groups ()
typeset func typeset func
typeset file=$(mktemp -t composure.XXXX) typeset file=$(mktemp -t composure.XXXX)
for func in $(typeset_functions) for func in $(_typeset_functions)
do do
typeset -f $func | metafor group >> $file typeset -f $func | metafor group >> $file
done done

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

@@ -69,6 +69,11 @@ function local_setup {
assert_line -n 0 "" assert_line -n 0 ""
} }
@test "helpers: bash-it help plugins" {
run bash-it help plugins
assert_line -n 1 "base:"
}
@test "helpers: bash-it help list aliases without any aliases enabled" { @test "helpers: bash-it help list aliases without any aliases enabled" {
run _help-list-aliases "$BASH_IT/aliases/available/ag.aliases.bash" run _help-list-aliases "$BASH_IT/aliases/available/ag.aliases.bash"
assert_line -n 0 "ag:" assert_line -n 0 "ag:"

View File

@@ -188,6 +188,12 @@ function terraform_workspace_prompt {
fi fi
} }
function active_gcloud_account_prompt {
if _command_exists gcloud; then
echo -e "$(gcloud config list account --format "value(core.account)" 2> /dev/null)"
fi
}
function git_prompt_minimal_info { function git_prompt_minimal_info {
SCM_STATE=${SCM_THEME_PROMPT_CLEAN} SCM_STATE=${SCM_THEME_PROMPT_CLEAN}

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

@@ -91,6 +91,9 @@ HISTORY_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_HISTORY_NUMBER_CHAR:="#"}
COMMAND_NUMBER_THEME_PROMPT_COLOR=${POWERLINE_COMMAND_NUMBER_COLOR:=0} COMMAND_NUMBER_THEME_PROMPT_COLOR=${POWERLINE_COMMAND_NUMBER_COLOR:=0}
COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"} COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"}
GCLOUD_THEME_PROMPT_COLOR=${POWERLINE_GCLOUD_COLOR:=161}
GCLOUD_CHAR=${POWERLINE_GCLOUD_CHAR:="G "}
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

@@ -86,6 +86,9 @@ HISTORY_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_HISTORY_NUMBER_CHAR:="#"}
COMMAND_NUMBER_THEME_PROMPT_COLOR=${POWERLINE_COMMAND_NUMBER_COLOR:=254} COMMAND_NUMBER_THEME_PROMPT_COLOR=${POWERLINE_COMMAND_NUMBER_COLOR:=254}
COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"} COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"}
GCLOUD_THEME_PROMPT_COLOR=${POWERLINE_GCLOUD_COLOR:=161}
GCLOUD_CHAR=${POWERLINE_GCLOUD_CHAR:="G "}
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

@@ -83,6 +83,9 @@ HISTORY_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_HISTORY_NUMBER_CHAR:="#"}
COMMAND_NUMBER_THEME_PROMPT_COLOR=${POWERLINE_COMMAND_NUMBER_COLOR:=0} COMMAND_NUMBER_THEME_PROMPT_COLOR=${POWERLINE_COMMAND_NUMBER_COLOR:=0}
COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"} COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"}
GCLOUD_THEME_PROMPT_COLOR=${POWERLINE_GCLOUD_COLOR:=161}
GCLOUD_CHAR=${POWERLINE_GCLOUD_CHAR:="G "}
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

@@ -49,6 +49,13 @@ function __powerline_terraform_prompt() {
fi fi
} }
function __powerline_gcloud_prompt() {
local active_gcloud_account=""
active_gcloud_account="$(active_gcloud_account_prompt)"
[[ -n "${active_gcloud_account}" ]] && echo "${GCLOUD_CHAR}${active_gcloud_account}|${GCLOUD_THEME_PROMPT_COLOR}"
}
function __powerline_node_prompt() { function __powerline_node_prompt() {
local node_version="" local node_version=""

View File

@@ -88,6 +88,9 @@ HISTORY_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_HISTORY_NUMBER_CHAR:="#"}
COMMAND_NUMBER_THEME_PROMPT_COLOR=${POWERLINE_COMMAND_NUMBER_COLOR:=0} COMMAND_NUMBER_THEME_PROMPT_COLOR=${POWERLINE_COMMAND_NUMBER_COLOR:=0}
COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"} COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"}
GCLOUD_THEME_PROMPT_COLOR=${POWERLINE_GCLOUD_COLOR:=161}
GCLOUD_CHAR=${POWERLINE_GCLOUD_CHAR:="G "}
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,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