zsh-workers
 help / color / mirror / code / Atom feed
* [completion file] AWS profiles
@ 2017-08-24  1:14 Phil Pennock
  0 siblings, 0 replies; only message in thread
From: Phil Pennock @ 2017-08-24  1:14 UTC (permalink / raw)
  To: zsh-workers

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-08-24  1:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-24  1:14 [completion file] AWS profiles Phil Pennock

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).