mirror of
https://github.com/oh-my-fish/theme-bobthefish.git
synced 2024-10-27 20:34:23 +00:00
Merge pull request #2 from rogierm/add-check-for-macos-in-aws-vault
add check for macos in aws-vault
This commit is contained in:
commit
3022ca1be3
@ -23,6 +23,9 @@ You will need a [Powerline-patched font][btf-patching] for this to work, unless
|
|||||||
|
|
||||||
This theme is based loosely on [agnoster][btf-agnoster].
|
This theme is based loosely on [agnoster][btf-agnoster].
|
||||||
|
|
||||||
|
For MacOS install coreutils to get gdate as date has a different syntax. This is required for aws-vault and awsume support in the bobthefish prompt on MacOS.
|
||||||
|
|
||||||
|
brew intall coreutils
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
@ -130,6 +133,7 @@ set -g theme_newline_prompt '$ '
|
|||||||
- `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_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_awsume_profile`. This feature is disabled by default. Use `yes` to show the currently executing awsume 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`.
|
||||||
- `theme_display_sudo_user`. If set to `yes`, displays the sudo-username in a root shell. For example, when calling `sudo -s` and having this option set to `yes`, the username of the user, who called `sudo -s`, will be displayed.
|
- `theme_display_sudo_user`. If set to `yes`, displays the sudo-username in a root shell. For example, when calling `sudo -s` and having this option set to `yes`, the username of the user, who called `sudo -s`, will be displayed.
|
||||||
|
@ -662,10 +662,15 @@ function __bobthefish_prompt_aws_vault_profile -S -d 'Show AWS Vault profile'
|
|||||||
[ -n "$AWS_VAULT" -a -n "$AWS_SESSION_EXPIRATION" ]
|
[ -n "$AWS_VAULT" -a -n "$AWS_SESSION_EXPIRATION" ]
|
||||||
or return
|
or return
|
||||||
|
|
||||||
set -l profile $AWS_VAULT
|
if test (uname) = Darwin
|
||||||
|
set now (gdate --utc +%s)
|
||||||
|
set expiry (gdate -d "$AWS_SESSION_EXPIRATION" +%s)
|
||||||
|
else
|
||||||
|
set now (date --utc +%s)
|
||||||
|
set expiry (date -d "$AWS_SESSION_EXPIRATION" +%s)
|
||||||
|
end
|
||||||
|
|
||||||
set -l now (date --utc +%s)
|
set -l profile $AWS_VAULT
|
||||||
set -l expiry (date -d "$AWS_SESSION_EXPIRATION" +%s)
|
|
||||||
set -l diff_mins (math "floor(( $expiry - $now ) / 60)")
|
set -l diff_mins (math "floor(( $expiry - $now ) / 60)")
|
||||||
|
|
||||||
set -l diff_time $diff_mins"m"
|
set -l diff_time $diff_mins"m"
|
||||||
|
Loading…
Reference in New Issue
Block a user