zsh-workers
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: zsh-workers@zsh.org
Subject: [completion file] AWS profiles
Date: Wed, 23 Aug 2017 21:14:13 -0400	[thread overview]
Message-ID: <20170824011413.GA41493@tower.spodhuis.org> (raw)

Various tools working with AWS honor a common set of environment
variables for defining access.  One of those is `AWS_PROFILE`, which
points to a name which is used for looking up various other values.
Profiles can be defined in ~/.aws/config in sections `[profile FOO]` or
in ~/.aws/credentials in sections `[FOO]` (notice dropped keyword).

For me, I always want the credentials file entries, because with a
reasonable `[default]` section you don't need per-profile entries in the
config file.

This is what I'm using and it might be suitable for inclusion with zsh?
Any improvements?

-------------------------8< _aws_credentials >8-------------------------
#compdef -value-,AWS_PROFILE,-default-

local expl

_wanted awscredentials expl 'AWS credentials profile name' \
  compadd "$@" - ${${${(Mo)${(f)"$(<${AWS_SHARED_CREDENTIALS_FILE:-$HOME/.aws/credentials})"}##\[*\]}#\[}%\]}
-------------------------8< _aws_credentials >8-------------------------

Use in conjunction with:

  zstyle ':completion:*' fake-parameters \
    AWS_PROFILE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY \
    AWS_DEFAULT_REGION AWS_SHARED_CREDENTIALS_FILE

for a better AWS-using experience.


                 reply	other threads:[~2017-08-24  1:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170824011413.GA41493@tower.spodhuis.org \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).