decline icon indicating copy to clipboard operation
decline copied to clipboard

enumerate all possible values for enum opts

Open antonkulaga opened this issue 4 years ago • 1 comments

The main advantage of Enum Opts over the string is that you have a full list of all available values. I believe that this should be included in help (currently I do it manually in the brackets which is timeconsuming and leads to errors if I change the enum and forget to change help) and also when the user makes a mistake in the option value it should tell her the list of all possible values from the enum in the error report

antonkulaga avatar May 17 '20 09:05 antonkulaga

for enums, it would be possible to change the error and the metavar pretty easily in the enumeratum integration. i'd be quite likely to accept a pr that added that. (though it may be wise to keep the current behavior for enums that are very large.)

there's no way to modify the option help text, and for various reasons (eg. those mentioned in the other issue you commented on) we're unlikely to add one. in cases where i want to keep a default value or similar in sync, i typically just use a constant and string templating... might be helpful in your case, if a bit less automatic than you were looking for!

Le dim. 17 mai 2020 à 05:22, Anton Kulaga [email protected] a écrit :

The main advantage of Enum Opts over the string is that you have a full list of all available values. I believe that this should be included in help (currently I do it manually in the brackets which is timeconsuming and leads to errors if I change the enum and forget to change help) and also when the user makes a mistake in the option value it should tell her the list of all possible values from the enum in the error report

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bkirwi/decline/issues/171, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMFXM464XIPAZC7CLBSGHLRR6UE5ANCNFSM4NDJRTWQ .

bkirwi avatar May 17 '20 20:05 bkirwi