mirror of
https://github.com/oh-my-fish/theme-bobthefish.git
synced 2025-06-13 13:03:54 +00:00
Merge b69c8b9ebb
into 332f23abd7
This commit is contained in:
commit
b3ead2cad1
@ -129,6 +129,7 @@ set -g theme_newline_prompt '$ '
|
|||||||
- `theme_display_vi`. By default the vi mode indicator will be shown if vi or hybrid key bindings are enabled. Use `no` to hide the indicator, or `yes` to show the indicator.
|
- `theme_display_vi`. By default the vi mode indicator will be shown if vi or hybrid key bindings are enabled. Use `no` to hide the indicator, or `yes` to show the indicator.
|
||||||
- `theme_display_k8s_context`. This feature is disabled by default. Use `yes` to show the current kubernetes context (`> kubectl config current-context`).
|
- `theme_display_k8s_context`. This feature is disabled by default. Use `yes` to show the current kubernetes context (`> kubectl config current-context`).
|
||||||
- `theme_display_k8s_namespace`. This feature is disabled by default. Use `yes` to show the current kubernetes namespace.
|
- `theme_display_k8s_namespace`. This feature is disabled by default. Use `yes` to show the current kubernetes namespace.
|
||||||
|
- `theme_display_aws_profile`. This feature is disabled by default. Use `yes` to show the currently [AWS](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) profile.
|
||||||
- `theme_display_aws_vault_profile`. This feature is disabled by default. Use `yes` to show the currently executing [AWS Vault](https://github.com/99designs/aws-vault) profile.
|
- `theme_display_aws_vault_profile`. This feature is disabled by default. Use `yes` to show the currently executing [AWS Vault](https://github.com/99designs/aws-vault) profile.
|
||||||
- `theme_display_user`. If set to `yes`, display username always, if set to `ssh`, only when an SSH-Session is detected, if set to no, never.
|
- `theme_display_user`. If set to `yes`, display username always, if set to `ssh`, only when an SSH-Session is detected, if set to no, never.
|
||||||
- `theme_display_hostname`. Same behaviour as `theme_display_user`.
|
- `theme_display_hostname`. Same behaviour as `theme_display_user`.
|
||||||
|
@ -28,7 +28,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
|
|||||||
|
|
||||||
set -x color_vagrant brcyan $colorfg
|
set -x color_vagrant brcyan $colorfg
|
||||||
set -x color_k8s magenta white --bold
|
set -x color_k8s magenta white --bold
|
||||||
set -x color_aws_vault blue $colorfg --bold
|
set -x color_aws blue $colorfg --bold
|
||||||
set -x color_aws_vault_expired blue red --bold
|
set -x color_aws_vault_expired blue red --bold
|
||||||
set -x color_username white black --bold
|
set -x color_username white black --bold
|
||||||
set -x color_hostname white black
|
set -x color_hostname white black
|
||||||
@ -63,7 +63,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
|
|||||||
|
|
||||||
set -x color_vagrant brcyan $colorfg
|
set -x color_vagrant brcyan $colorfg
|
||||||
set -x color_k8s magenta white --bold
|
set -x color_k8s magenta white --bold
|
||||||
set -x color_aws_vault blue $colorfg --bold
|
set -x color_aws blue $colorfg --bold
|
||||||
set -x color_aws_vault_expired blue red --bold
|
set -x color_aws_vault_expired blue red --bold
|
||||||
set -x color_username black white --bold
|
set -x color_username black white --bold
|
||||||
set -x color_hostname black white
|
set -x color_hostname black white
|
||||||
@ -98,7 +98,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
|
|||||||
|
|
||||||
set -x color_vagrant brcyan $colorfg
|
set -x color_vagrant brcyan $colorfg
|
||||||
set -x color_k8s magenta white --bold
|
set -x color_k8s magenta white --bold
|
||||||
set -x color_aws_vault blue $colorfg --bold
|
set -x color_aws blue $colorfg --bold
|
||||||
set -x color_aws_vault_expired blue red --bold
|
set -x color_aws_vault_expired blue red --bold
|
||||||
set -x color_username brgrey white --bold
|
set -x color_username brgrey white --bold
|
||||||
set -x color_hostname brgrey white
|
set -x color_hostname brgrey white
|
||||||
@ -133,7 +133,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
|
|||||||
|
|
||||||
set -x color_vagrant brcyan $colorfg
|
set -x color_vagrant brcyan $colorfg
|
||||||
set -x color_k8s magenta white --bold
|
set -x color_k8s magenta white --bold
|
||||||
set -x color_aws_vault blue $colorfg --bold
|
set -x color_aws blue $colorfg --bold
|
||||||
set -x color_aws_vault_expired blue red --bold
|
set -x color_aws_vault_expired blue red --bold
|
||||||
set -x color_username grey black --bold
|
set -x color_username grey black --bold
|
||||||
set -x color_hostname grey black
|
set -x color_hostname grey black
|
||||||
@ -174,7 +174,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
|
|||||||
|
|
||||||
set -x color_vagrant $blue $green --bold
|
set -x color_vagrant $blue $green --bold
|
||||||
set -x color_k8s $green $white --bold
|
set -x color_k8s $green $white --bold
|
||||||
set -x color_aws_vault $blue $grey --bold
|
set -x color_aws $blue $grey --bold
|
||||||
set -x color_aws_vault_expired $blue $red --bold
|
set -x color_aws_vault_expired $blue $red --bold
|
||||||
set -x color_username $grey $blue --bold
|
set -x color_username $grey $blue --bold
|
||||||
set -x color_hostname $grey $blue
|
set -x color_hostname $grey $blue
|
||||||
@ -226,7 +226,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
|
|||||||
|
|
||||||
set -x color_vagrant $base0C $colorfg --bold
|
set -x color_vagrant $base0C $colorfg --bold
|
||||||
set -x color_k8s $base06 $colorfg --bold
|
set -x color_k8s $base06 $colorfg --bold
|
||||||
set -x color_aws_vault $base0D $colorfg --bold
|
set -x color_aws $base0D $colorfg --bold
|
||||||
set -x color_aws_vault_expired $base0D $base08 --bold
|
set -x color_aws_vault_expired $base0D $base08 --bold
|
||||||
set -x color_username $base02 $base0D --bold
|
set -x color_username $base02 $base0D --bold
|
||||||
set -x color_hostname $base02 $base0D
|
set -x color_hostname $base02 $base0D
|
||||||
@ -278,7 +278,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
|
|||||||
|
|
||||||
set -x color_vagrant $base0C $colorfg --bold
|
set -x color_vagrant $base0C $colorfg --bold
|
||||||
set -x color_k8s $base0B $colorfg --bold
|
set -x color_k8s $base0B $colorfg --bold
|
||||||
set -x color_aws_vault $base0D $base0A --bold
|
set -x color_aws $base0D $base0A --bold
|
||||||
set -x color_aws_vault_expired $base0D $base08 --bold
|
set -x color_aws_vault_expired $base0D $base08 --bold
|
||||||
set -x color_username $base02 $base0D --bold
|
set -x color_username $base02 $base0D --bold
|
||||||
set -x color_hostname $base02 $base0D
|
set -x color_hostname $base02 $base0D
|
||||||
@ -330,7 +330,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
|
|||||||
|
|
||||||
set -x color_vagrant $violet $colorfg --bold
|
set -x color_vagrant $violet $colorfg --bold
|
||||||
set -x color_k8s $green $colorfg --bold
|
set -x color_k8s $green $colorfg --bold
|
||||||
set -x color_aws_vault $violet $base3 --bold
|
set -x color_aws $violet $base3 --bold
|
||||||
set -x color_aws_vault_expired $violet $orange --bold
|
set -x color_aws_vault_expired $violet $orange --bold
|
||||||
set -x color_username $base2 $blue --bold
|
set -x color_username $base2 $blue --bold
|
||||||
set -x color_hostname $base2 $blue
|
set -x color_hostname $base2 $blue
|
||||||
@ -382,7 +382,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
|
|||||||
|
|
||||||
set -x color_vagrant $violet $colorfg --bold
|
set -x color_vagrant $violet $colorfg --bold
|
||||||
set -x color_k8s $green $colorfg --bold
|
set -x color_k8s $green $colorfg --bold
|
||||||
set -x color_aws_vault $violet $base3 --bold
|
set -x color_aws $violet $base3 --bold
|
||||||
set -x color_aws_vault_expired $violet $orange --bold
|
set -x color_aws_vault_expired $violet $orange --bold
|
||||||
set -x color_username $base02 $blue --bold
|
set -x color_username $base02 $blue --bold
|
||||||
set -x color_hostname $base02 $blue
|
set -x color_hostname $base02 $blue
|
||||||
@ -427,7 +427,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
|
|||||||
|
|
||||||
set -x color_vagrant $blue[1] $white --bold
|
set -x color_vagrant $blue[1] $white --bold
|
||||||
set -x color_k8s $green[1] $colorfg --bold
|
set -x color_k8s $green[1] $colorfg --bold
|
||||||
set -x color_aws_vault $blue[3] $orange[1] --bold
|
set -x color_aws $blue[3] $orange[1] --bold
|
||||||
set -x color_aws_vault_expired $blue[3] $red[3] --bold
|
set -x color_aws_vault_expired $blue[3] $red[3] --bold
|
||||||
set -x color_username $grey[1] $blue[3] --bold
|
set -x color_username $grey[1] $blue[3] --bold
|
||||||
set -x color_hostname $grey[1] $blue[3]
|
set -x color_hostname $grey[1] $blue[3]
|
||||||
@ -471,7 +471,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
|
|||||||
|
|
||||||
set -x color_vagrant $blue[2] $fg[2] --bold
|
set -x color_vagrant $blue[2] $fg[2] --bold
|
||||||
set -x color_k8s $green[2] $fg[2] --bold
|
set -x color_k8s $green[2] $fg[2] --bold
|
||||||
set -x color_aws_vault $blue[2] $yellow[1] --bold
|
set -x color_aws $blue[2] $yellow[1] --bold
|
||||||
set -x color_aws_vault_expired $blue[2] $red[1] --bold
|
set -x color_aws_vault_expired $blue[2] $red[1] --bold
|
||||||
set -x color_username $fg[3] $blue[2] --bold
|
set -x color_username $fg[3] $blue[2] --bold
|
||||||
set -x color_hostname $fg[3] $blue[2]
|
set -x color_hostname $fg[3] $blue[2]
|
||||||
@ -517,7 +517,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
|
|||||||
|
|
||||||
set -x color_vagrant $pink $bg --bold
|
set -x color_vagrant $pink $bg --bold
|
||||||
set -x color_k8s $green $fg --bold
|
set -x color_k8s $green $fg --bold
|
||||||
set -x color_aws_vault $comment $yellow --bold
|
set -x color_aws $comment $yellow --bold
|
||||||
set -x color_aws_vault_expired $comment $red --bold
|
set -x color_aws_vault_expired $comment $red --bold
|
||||||
set -x color_username $selection $cyan --bold
|
set -x color_username $selection $cyan --bold
|
||||||
set -x color_hostname $selection $cyan
|
set -x color_hostname $selection $cyan
|
||||||
@ -569,7 +569,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
|
|||||||
|
|
||||||
set -x color_vagrant $base02 $colorfg --bold
|
set -x color_vagrant $base02 $colorfg --bold
|
||||||
set -x color_k8s $base02 $colorfg --bold
|
set -x color_k8s $base02 $colorfg --bold
|
||||||
set -x color_aws_vault $base0A $base0D --bold
|
set -x color_aws $base0A $base0D --bold
|
||||||
set -x color_aws_vault_expired $base0A $base0B --bold
|
set -x color_aws_vault_expired $base0A $base0B --bold
|
||||||
set -x color_username $base02 $base0D --bold
|
set -x color_username $base02 $base0D --bold
|
||||||
set -x color_hostname $base02 $base0D
|
set -x color_hostname $base02 $base0D
|
||||||
@ -614,7 +614,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
|
|||||||
|
|
||||||
set -x color_vagrant $blue[1] $white --bold
|
set -x color_vagrant $blue[1] $white --bold
|
||||||
set -x color_k8s $green[2] $white --bold
|
set -x color_k8s $green[2] $white --bold
|
||||||
set -x color_aws_vault $blue[3] $orange[1] --bold
|
set -x color_aws $blue[3] $orange[1] --bold
|
||||||
set -x color_aws_vault_expired $blue[3] $red[3] --bold
|
set -x color_aws_vault_expired $blue[3] $red[3] --bold
|
||||||
set -x color_username $grey[1] $blue[3] --bold
|
set -x color_username $grey[1] $blue[3] --bold
|
||||||
set -x color_hostname $grey[1] $blue[3]
|
set -x color_hostname $grey[1] $blue[3]
|
||||||
@ -682,7 +682,7 @@ function __bobthefish_user_color_scheme_deprecated
|
|||||||
set -x color_vi_mode_insert $__color_vi_mode_insert
|
set -x color_vi_mode_insert $__color_vi_mode_insert
|
||||||
set -x color_vi_mode_visual $__color_vi_mode_visual
|
set -x color_vi_mode_visual $__color_vi_mode_visual
|
||||||
set -x color_vagrant $__color_vagrant
|
set -x color_vagrant $__color_vagrant
|
||||||
set -x color_aws_vault $__color_aws_vault
|
set -x color_aws $__color_aws_vault
|
||||||
set -x color_aws_vault_expired $__color_aws_vault_expired
|
set -x color_aws_vault_expired $__color_aws_vault_expired
|
||||||
set -x color_username $__color_username
|
set -x color_username $__color_username
|
||||||
set -x color_hostname $__color_hostname
|
set -x color_hostname $__color_hostname
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
# set -g theme_display_docker_machine no
|
# set -g theme_display_docker_machine no
|
||||||
# set -g theme_display_k8s_context yes
|
# set -g theme_display_k8s_context yes
|
||||||
# set -g theme_display_k8s_namespace no
|
# set -g theme_display_k8s_namespace no
|
||||||
|
# set -g theme_display_aws_profile yes
|
||||||
# set -g theme_display_aws_vault_profile yes
|
# set -g theme_display_aws_vault_profile yes
|
||||||
# set -g theme_display_hg yes
|
# set -g theme_display_hg yes
|
||||||
# set -g theme_display_virtualenv no
|
# set -g theme_display_virtualenv no
|
||||||
@ -654,32 +655,35 @@ end
|
|||||||
# Cloud Tools
|
# Cloud Tools
|
||||||
# ==============================
|
# ==============================
|
||||||
|
|
||||||
function __bobthefish_prompt_aws_vault_profile -S -d 'Show AWS Vault profile'
|
function __bobthefish_prompt_aws_profile -S -d 'Show AWS profile'
|
||||||
[ "$theme_display_aws_vault_profile" = 'yes' ]
|
[ "$theme_display_aws_profile" = 'yes' -o "$theme_display_aws_vault_profile" = 'yes' ]
|
||||||
or return
|
or return
|
||||||
|
|
||||||
[ -n "$AWS_VAULT" -a -n "$AWS_SESSION_EXPIRATION" ]
|
if set -q "AWS_PROFILE"
|
||||||
or return
|
__bobthefish_start_segment $color_aws
|
||||||
|
echo -ns $AWS_PROFILE ' '
|
||||||
|
end
|
||||||
|
|
||||||
set -l profile $AWS_VAULT
|
if set -q "AWS_VAULT"
|
||||||
|
set -l now (date --utc +%s)
|
||||||
|
set -l expiry (date -d "$AWS_SESSION_EXPIRATION" +%s)
|
||||||
|
set -l diff_mins (math "floor(( $expiry - $now ) / 60)")
|
||||||
|
|
||||||
set -l now (date --utc +%s)
|
set -l diff_time $diff_mins"m"
|
||||||
set -l expiry (date -d "$AWS_SESSION_EXPIRATION" +%s)
|
[ $diff_mins -le 0 ]
|
||||||
set -l diff_mins (math "floor(( $expiry - $now ) / 60)")
|
and set -l diff_time '0m'
|
||||||
|
[ $diff_mins -ge 60 ]
|
||||||
|
and set -l diff_time (math "floor($diff_mins / 60)")"h"(math "$diff_mins % 60")"m"
|
||||||
|
|
||||||
set -l diff_time $diff_mins"m"
|
set -l segment $profile ' (' $diff_time ')'
|
||||||
[ $diff_mins -le 0 ]
|
set -l status_color $color_aws
|
||||||
and set -l diff_time '0m'
|
[ $diff_mins -le 0 ]
|
||||||
[ $diff_mins -ge 60 ]
|
and set -l status_color $color_aws_vault_expired
|
||||||
and set -l diff_time (math "floor($diff_mins / 60)")"h"(math "$diff_mins % 60")"m"
|
|
||||||
|
|
||||||
set -l segment $profile ' (' $diff_time ')'
|
|
||||||
set -l status_color $color_aws_vault
|
|
||||||
[ $diff_mins -le 0 ]
|
|
||||||
and set -l status_color $color_aws_vault_expired
|
|
||||||
|
|
||||||
__bobthefish_start_segment $status_color
|
__bobthefish_start_segment $color_aws
|
||||||
echo -ns $segment ' '
|
echo -ns $AWS_VAULT ' '
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -1133,7 +1137,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
|
|||||||
__bobthefish_prompt_k8s_context
|
__bobthefish_prompt_k8s_context
|
||||||
|
|
||||||
# Cloud Tools
|
# Cloud Tools
|
||||||
__bobthefish_prompt_aws_vault_profile
|
__bobthefish_prompt_aws_profile
|
||||||
|
|
||||||
# Virtual environments
|
# Virtual environments
|
||||||
__bobthefish_prompt_nix
|
__bobthefish_prompt_nix
|
||||||
|
Loading…
Reference in New Issue
Block a user