aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

Add ability to specify a yaml file as parameters

Open aidando73 opened this issue 2 years ago • 4 comments

*Issue #2275

  • Adds ability to specify a yaml file as parameters
  • Will work for any list yaml files (but not for dictionary yaml files)

Screencast from 25-08-23 18:45:15.webm

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

aidando73 avatar Aug 25 '23 09:08 aidando73

Codecov Report

Attention: Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.

Project coverage is 93.11%. Comparing base (27f75db) to head (f5b7fcd). Report is 1642 commits behind head on v2.

Files with missing lines Patch % Lines
awscli/argprocess.py 82.35% 2 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##               v2    #8133      +/-   ##
==========================================
- Coverage   93.12%   93.11%   -0.01%     
==========================================
  Files         363      363              
  Lines       38291    38308      +17     
  Branches     6127     6130       +3     
==========================================
+ Hits        35657    35670      +13     
- Misses       1963     1968       +5     
+ Partials      671      670       -1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Aug 25 '23 10:08 codecov-commenter

I just realized there's another PR that aims to achieves something similar https://github.com/aws/aws-cli/pull/5482/ but with a different approach.

Up to you guys which approach you want to choose.

aidando73 avatar Aug 25 '23 10:08 aidando73

One drawback of my approach is that it's difficult to provide useful error messages; It's difficult to determine whether the argument passed in is an invalid yaml document or shorthand or JSON - since we try and parse the full yaml document.

Alternatives might be:

  • Parse yaml files based on file extensions .yml or .yaml (though there might be use cases where file extensions are not .yml or .yaml)
  • Go with the yaml:// prefix idea

These would allow better error messages

aidando73 avatar Aug 26 '23 07:08 aidando73

The more I think about it, the more file extension based matching makes more sense. Let me know if you want me to redo this PR

aidando73 avatar Sep 02 '23 09:09 aidando73