diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2014-02-26 14:25:13 +0100 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2014-02-26 14:25:13 +0100 |
commit | 5fc1a74d0b484eb1a2d28689a294e9eebcd97c78 (patch) | |
tree | 5cef69c43e7913de330c6fa355a696ec5af89550 /utils.py | |
parent | cde3067d6cbad0491aa9d8d153aca043b5163f3b (diff) | |
download | clufter-5fc1a74d0b484eb1a2d28689a294e9eebcd97c78.tar.gz clufter-5fc1a74d0b484eb1a2d28689a294e9eebcd97c78.tar.xz clufter-5fc1a74d0b484eb1a2d28689a294e9eebcd97c78.zip |
command: automagically figure out the short opts for long ones
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -139,6 +139,14 @@ def which(name, *where): else: return None +# prioritize consonants, deprioritize vowels (except for the first letter +# overall), which seems to be widely adopted technique for selecting short +# options based on their long counterparts :) +longopt_letters_reprio = \ + lambda longopt: \ + longopt[0] + ''.join(sorted(longopt[1:], + key=lambda x: int(x.lower() in 'aeiouy'))) + # extrapolate optparse.make_option to specifically-encoded "plural" make_options = lambda opt_decl: [make_option(*a, **kw) for a, kw in opt_decl] |