awslabs / aws-shell

An integrated shell for working with the AWS CLI.
Apache License 2.0
7.19k stars 773 forks source link

Feature request: Add support for variables #114

Open jamesls opened 8 years ago

jamesls commented 8 years ago

Not sure about the specifics, but at a high level, it would be nice to do something like:

aws> variable=$(ec2 describe-instances --query "Reservations[0].Instances[0].InstanceId" --output text) 
aws> ec2 start-instances --instance-ids $variable 
donnemartin commented 8 years ago

I think this would be helpful, maybe we could persist them across sessions. SAWS has shortcuts:

# Saws will auto-complete the following --ec2-state auto-completions:
#   [pending | running | shutting-down | terminated | stopping | stopped]
# Usage:
#   ec2 ls --ec2-state
'ec2 ls --ec2-state' = 'ec2 describe-instances --filters "Name=instance-state-name,Values=%s"'

# Simple 'ls' shortcuts
'ec2 ls' = 'ec2 describe-instances'

Regarding implementation, the method above was just a first-pass--set some variables in a config file and sub them in. I like how your proposal would allow variables to be set while aws-shell is running.

faisalp4p commented 8 years ago

Yes i also met with this requirement, was going to make an issue about the same. It would be helpful +1