Repository navigation
Conversation
Contributor
|
Thanks for this, the Two small requests before merge: 1. Help text for tags
That looks intentional since 26926f7 (tag values without names would be ambiguous), so the help text should say so rather than claim tag keys are suppressed. Suggested wording: 2. Man page Please update |
Author
|
Thanks for the review @ericsu66888! I've updated the help text to clarify the tag behavior and updated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves the usability and ergonomics of the
--quietoption inec2-metadata:-qtoshortoptsand the option parser, allowing-qto be used alongside flags like-i,-o, and-z.--helpdescription to reflect that--quietsuppresses keys across all metrics, not just tags.Motivation
While
ec2-metadatasupports--quietto output raw values directly (suppressing prefix labels likeinstance-id:), users frequently encounter two stumbling blocks:-q: Attemptingec2-metadata -i -qfails withgetopt: invalid option -- 'q'.ec2-metadata --helpdescribes--quietas:--quietonly applies when querying--tags, even though[ -z "$QUIET" ]inprint_normal_metric()suppresses label prefixes across all standard metrics.Changes
qtoshortopts.caseloop to handle-q|--quiet).print_help()to display-q/--quiet Suppress metric and tag keys from the output (value only).Testing
Verified against IMDS:
ec2-metadata -i --quiet->i-0123456789abcdef0ec2-metadata -i -q->i-0123456789abcdef0ec2-metadata -o -q->10.0.1.25ec2-metadata -z -q->ap-southeast-2aec2-metadata -i(default) ->instance-id: i-0123456789abcdef0(backwards compatibility preserved)