aws-sso-cli
aws-sso-cli copied to clipboard
nushell support for shell-helpers
Is your feature request related to a problem? Please describe. It would be great to add nushell support for shell-helpers
Additional context Nushell is a modern shell. aws-sso-cli could be a nice replacement for the oh-my-zsh aws plugin, which obviously does not work in nushell.
@b0lle: Lots of shells out there and while I'm sure nushell is awesome, I've honestly never heard of it which makes this a low priority for me. If someone provides a pull request to add the shell helper code, that would help a lot and dramatically improve the chances this happens.
Here's how I hacked it into nushell:
#!/usr/bin/env nu
def --env aws-sso-profile [
profile: string
] {
let _args = (if ($env.AWS_SSO_HELPER_ARGS? | is-empty) { '-L error' } else { $env.AWS_SSO_HELPER_ARGS })
if ($env.AWS_PROFILE? | is-not-empty) {
print "Unable to assume a role while AWS_PROFILE is set"
return 1
}
XONSH_VERSION=1 aws-sso eval -p $profile | lines | parse "${name} = '{value}'" | reduce -f {} {|it, acc| $acc | upsert $it.name $it.value} | load-env
if ($env.AWS_SSO_PROFILE? != $profile) {
return 1
}
}
def --env aws-sso-clear [] {
let _args = (if ($env.AWS_SSO_HELPER_ARGS? | is-empty) { '-L error' } else { $env.AWS_SSO_HELPER_ARGS })
if ($env.AWS_SSO_PROFILE? | is-empty) {
print "AWS_SSO_PROFILE is not set"
return 1
}
for row in (XONSH_VERSION=1 aws-sso eval -c | lines | parse "del ${name}") { hide-env $row.name }
}