awsls icon indicating copy to clipboard operation
awsls copied to clipboard

Feature request / discussion: add a config file to remember which attributes to list for specific resources

Open jacobian opened this issue 3 years ago • 2 comments

I love awsls, it makes my live so much easier! I have an idea/feature request. I'd be happy to take a stab at a PR, but I want to make sure it's something you'd like first:

Nearly time I use awsls, I need to remember to give some specific -attributes to make the output useful. A quick trawl through my shell history shows things like

awsls -attributes instance_state,public_dns aws_instance
awsls -attributes=name,tags aws_ami
awsls -attributes vpc_id,cidr_block aws_subnet

repeated over and over again.

What if there was a config file that remembered that when I list AMIs, I want name and tags, etc? i.e., it could look something like

[awsls]
aws_instance = instance_state,public_dns
aws_ami = name,tags
aws_subnet = vpc_id,cidr_block

Then, awsls aws_instance would use those attributes.

Again, I'm happy to take a stab at a PR if this is something that you'd find useful and in line with your intentions for the tool. I'm not super-great at Go but I can probably come up with something reasonable as a starting point.

jacobian avatar Aug 03 '20 12:08 jacobian

Hi @jacobian :wave:

sorry for my late reply. This sounds actually like really great idea.

Just brainstorming here:

  • awsls could look for a default config in ~/.awsls/config (the folder ~/.awsls/ exists already when using awsls to store the Terraform AWS Provider binary)
  • using --attributes flag overwrites whatever is specified in the config file
  • do we need a [awsls] header in the config file?
  • my 2 cents: providing a custom path via a flag --config <path/to/config> is probably not necessary in a first go

Creating a PR is very appreciated. If you have questions about Go or need feedback about your code at any point, let me know. If you get stuck, I can also jump in and help you finish the feature.

Thanks, Jan

jckuester avatar Aug 08 '20 13:08 jckuester

Lovely, sounds like we're thinking exactly on the same lines. Yes, I'll give this a stab and see where I can get, thanks!

jacobian avatar Aug 10 '20 11:08 jacobian