mirror of https://github.com/ohmyzsh/ohmyzsh.git
Compare commits
4 Commits
e6c98442ab
...
554b5221a8
Author | SHA1 | Date |
---|---|---|
Hans Donner | 554b5221a8 | |
Thomas | cae2e45193 | |
Carlo Sala | 276e540eed | |
Hans Donner | 26202bfeb0 |
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
function omz {
|
||||
setopt localoptions noksharrays
|
||||
[[ $# -gt 0 ]] || {
|
||||
_omz::help
|
||||
return 1
|
||||
|
|
|
@ -103,8 +103,25 @@ function acp() {
|
|||
local aws_secret_access_key="$(aws configure get aws_secret_access_key --profile $profile)"
|
||||
local aws_session_token="$(aws configure get aws_session_token --profile $profile)"
|
||||
|
||||
# Are we using SSO?
|
||||
local sso_start_url="$(aws configure get sso_start_url --profile $profile)"
|
||||
if [[ -n "sso_start_url" ]]; then
|
||||
# And is the session still valid?
|
||||
aws sts get-caller-identity --profile $profile > /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
aws sso login --profile $profile
|
||||
fi
|
||||
if [ $? -eq 0 ]; then
|
||||
export AWS_DEFAULT_PROFILE="$profile"
|
||||
export AWS_PROFILE="$profile"
|
||||
export AWS_EB_PROFILE="$profile"
|
||||
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
|
||||
echo "Switched to AWS Profile: $profile"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
# First, if the profile has MFA configured, lets get the token and session duration
|
||||
# If the profile has MFA configured, lets get the token and session duration
|
||||
local mfa_serial="$(aws configure get mfa_serial --profile $profile)"
|
||||
local sess_duration="$(aws configure get duration_seconds --profile $profile)"
|
||||
|
||||
|
|
|
@ -22,5 +22,5 @@ fi
|
|||
rustup completions zsh >| "$ZSH_CACHE_DIR/completions/_rustup" &|
|
||||
cat >| "$ZSH_CACHE_DIR/completions/_cargo" <<'EOF'
|
||||
#compdef cargo
|
||||
source "$(rustc +${${(z)$(rustup default)}[1]} --print sysroot)"/share/zsh/site-functions/_cargo
|
||||
source "$(rustup run ${${(z)$(rustup default)}[1]} rustc --print sysroot)"/share/zsh/site-functions/_cargo
|
||||
EOF
|
||||
|
|
Loading…
Reference in New Issue