From 5a4cf2c7598fae841bc3593ad63b83cc0693bde7 Mon Sep 17 00:00:00 2001 From: Chris Grau Date: Wed, 15 Apr 2020 10:14:07 -0700 Subject: [PATCH] Add option support for `okta-awscli` This patch adds support for the options to the `okta-awscli` command. Support for this command is being introduced, because the `aws-okta` command has been put on what the author refers to as an "indefinite hiatus." --- README.md | 7 +++++-- okta.plugin.zsh | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a430435..b0265c6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ -# AWS Okta (aws-okta) plugin +# Okta plugin This plugin provides command line completions for the -[`aws-okta`](https://github.com/segmentio/aws-okta) command. +[`aws-okta`](https://github.com/segmentio/aws-okta) and +[`okta-awscli`](https://github.com/jmhale/okta-awscli) commands. Note that the +`aws-okta` command has been put on what the author refers to as an +[indefinite hiatus](https://github.com/segmentio/aws-okta/issues/278). This plugin provides the following convenience functions. diff --git a/okta.plugin.zsh b/okta.plugin.zsh index 520069d..c8ab168 100644 --- a/okta.plugin.zsh +++ b/okta.plugin.zsh @@ -119,6 +119,8 @@ function _aws_okta_write_to_credentials() { '2:credentials_file:_files' } +# https://github.com/segmentio/aws-okta +# Note about deprecation: https://github.com/segmentio/aws-okta/issues/278 function _aws_okta() { local line @@ -142,3 +144,26 @@ function _aws_okta() { } compdef _aws_okta aws-okta compdef _aws_okta_profiles aop + +# https://github.com/jmhale/okta-awscli +function _okta_awscli() { + local curcontext=$curcontext state state_descr line ret=1 + typeset -A opt_args + + # TODO: How to hook into the aws command completion instead of using _normal? + _arguments \ + '(-v --verbose)'{-v,--verbose}'[Enables verbose mode]' \ + '(- *)'{-V,--version}'[Outputs version number and exits]' \ + '(-d --debug)'{-d,--debug}'[Enables debug mode]' \ + '(-f --force)'{-f,--force}'[Forces new STS credentials; skips STS credentials validation]' \ + '--okta-profile+[Name of the profile to use in .okta-aws]:TEXT:' \ + '--profile+[Name of the profile to store temporary credentials in ~/.aws/credentials]:TEXT:' \ + '(-c --cache)'{-c,--cache}'[Cache the default profile credentials to ~/.okta-credentials.cache]' \ + '(-t --token)'{-t,--token}+'[TOTP token from your authenticator app]:TEXT:' \ + '(- *)--help[Show help message and exit]' \ + '*:: :_normal' \ + && ret=0 + + return ret +} +compdef _okta_awscli okta-awscli