I have a utility which allows a user to read their ~/.aws/credentials
file and export environment variables.
Currently, the CLI interface looks like this:
usage: aws-env [-h] [-n] profile
Extract AWS credentials for a given profile as environment variables.
positional arguments:
profile The profile in ~/.aws/credentials to extract credentials
for.
optional arguments:
-h, --help show this help message and exit
-n, --no-export Do not use export on the variables.
What I'd like to do here is provide a ls
subparser that will allow the user to list the valid profile names in their ~/.aws/credentials
.
The interface would be something like this:
$ aws-env ls
profile-1
profile-2
...etcetera. Is there a way that I can natively do this in argparse so that an option appears in my -h
output which shows that ls
is a valid command?