Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated select-aws-profile script to work with nushell version >= 0.94.2 #876

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions modules/aws/select-aws-profile.nu
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@
#
# Usage
# select-aws-profile
export def select-aws-profile [] {
export def --env main [] {
hide AWS_REGION;

(do {
let creds = (open ($env.HOME + "/.aws/credentials") | from toml)
let selectedProfile = (for it in ($creds | transpose name creds) {
echo $it.name
})

selectedProfile = selectedProfile | str join "\n" | fzf | str trim
let profiles = $creds | transpose name creds | each {|x| printf $x.name }
let selectedProfile = $profiles | str join "\n" | fzf | str trim

if $selectedProfile != "" {
let out = {
Expand All @@ -42,4 +39,4 @@ export def select-aws-profile [] {
AWS_SECRET_ACCESS_KEY: $env.AWS_SECRET_ACCESS_KEY,
AWS_REGION: $env.AWS_REGION
}
}
}