diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2014-03-06 19:47:49 +0100 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2014-03-06 19:52:02 +0100 |
commit | 7269bb0e809d9b517b7e47b9da109ea827f7dae0 (patch) | |
tree | 890091ef59315b8aea057bf20250d2775f053102 /utils.py | |
parent | a6ee860c67224208451994e978b88483fcc2c0f8 (diff) | |
download | clufter-7269bb0e809d9b517b7e47b9da109ea827f7dae0.tar.gz clufter-7269bb0e809d9b517b7e47b9da109ea827f7dae0.tar.xz clufter-7269bb0e809d9b517b7e47b9da109ea827f7dae0.zip |
Formalize s/_/-/g + inverse transformation as functions
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -139,6 +139,20 @@ def which(name, *where): else: return None + +# +# command-line options and function introspection related +# + +# dashes recommended by 5 of 4 terminal fanboys +# NB underscores -> dashes swap is idempotent in regards to the member +# name of where optparse stores respective option value, but here +# the list of possible operations to preserve such property stops! +# + also to preserve reversibility/bijection, original ought to be +# free of the substituting character +cli_decor = lambda x: x.replace('_', '-') +cli_undecor = lambda x: x.replace('-', '_') + # 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 ;) |