mirror of
https://github.com/nushell/nu_scripts.git
synced 2024-09-11 13:45:56 +03:00
Updated select-aws-profile script to work with nushell version >= 0.94.2
Signed-off-by: necromeo <andrescheel@protonmail.com>
This commit is contained in:
parent
398cc82308
commit
c497d09293
@ -9,16 +9,13 @@
|
|||||||
#
|
#
|
||||||
# Usage
|
# Usage
|
||||||
# select-aws-profile
|
# select-aws-profile
|
||||||
export def select-aws-profile [] {
|
export def --env main [] {
|
||||||
hide AWS_REGION;
|
hide AWS_REGION;
|
||||||
|
|
||||||
(do {
|
(do {
|
||||||
let creds = (open ($env.HOME + "/.aws/credentials") | from toml)
|
let creds = (open ($env.HOME + "/.aws/credentials") | from toml)
|
||||||
let selectedProfile = (for it in ($creds | transpose name creds) {
|
let profiles = $creds | transpose name creds | each {|x| printf $x.name }
|
||||||
echo $it.name
|
let selectedProfile = $profiles | str join "\n" | fzf | str trim
|
||||||
})
|
|
||||||
|
|
||||||
selectedProfile = selectedProfile | str join "\n" | fzf | str trim
|
|
||||||
|
|
||||||
if $selectedProfile != "" {
|
if $selectedProfile != "" {
|
||||||
let out = {
|
let out = {
|
||||||
@ -42,4 +39,4 @@ export def select-aws-profile [] {
|
|||||||
AWS_SECRET_ACCESS_KEY: $env.AWS_SECRET_ACCESS_KEY,
|
AWS_SECRET_ACCESS_KEY: $env.AWS_SECRET_ACCESS_KEY,
|
||||||
AWS_REGION: $env.AWS_REGION
|
AWS_REGION: $env.AWS_REGION
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user