pflag icon indicating copy to clipboard operation
pflag copied to clipboard

Print Default Values of String-to-String in Sorted Order

Open vaguecoder opened this issue 3 years ago • 2 comments

Motivation

Issue 362 reported by @SOF3

Changes

Sort keys before stringifying string-to-string flag values.

Summary

String-to-string default values in usage would print in sorted order of keys. Eg. --foo stringToString usage (default [a=b,c=d]) In the example as per #362, now, the order will be always default [a=b,c=d]

Related Issues

Closes #362

vaguecoder avatar Nov 19 '22 16:11 vaguecoder

what about string to other types like integers?

SOF3 avatar Nov 20 '22 02:11 SOF3

what about string to other types like integers?

Yes, there are another 2 places. Let this PR be a PoC. We can have set of issue-PR to address those.

  1. String to int
  2. String to int64

vaguecoder avatar Nov 20 '22 02:11 vaguecoder