Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[completion file] AWS profiles
- X-seq: zsh-workers 41591
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [completion file] AWS profiles
- Date: Wed, 23 Aug 2017 21:14:13 -0400
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d201708; h=Content-Type:MIME-Version:Message-ID:Subject:To: From:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=R1YOqB/Pv+pfsysuc6hlTXAaoZ8DlI1lXWArvkbiucQ=; b=jIQySjSn5F7IT3eIU2aMpg5Nsg ehdfuf7NI54qWD+vyqVYyu5QwC6axWupD7NHVbMRGuUDuC4TwUWIz2nOD9iX4BrPcZATQmFqxb+pJ C5iV9FMvMGDPulQolh0sZbAVpHmjVVf4wFssOXluIdZuPmr4CK+NgPetymUgCyCfCmyes50cEfJ1s WQ0GLvu8aA+InbrGTANY0joCVyLo;
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Openpgp: url=https://www.security.spodhuis.org/PGP/keys/0x4D1E900E14C1CC04.asc
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author