From: rread Date: Fri, 7 Nov 2003 21:45:46 +0000 (+0000) Subject: transparently convert '-' to '_' in command line options. X-Git-Tag: v1_7_0_51~2^9~188 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=91adddf31d9ab52c7419fffa2df6d18749a734fb;p=fs%2Flustre-release.git transparently convert '-' to '_' in command line options. so, for example, you can use --write-conf if you want --- diff --git a/lustre/utils/Lustre/cmdline.py b/lustre/utils/Lustre/cmdline.py index 9da69f7..d2a39f6 100644 --- a/lustre/utils/Lustre/cmdline.py +++ b/lustre/utils/Lustre/cmdline.py @@ -40,7 +40,10 @@ class Options: if self.type(opt) in (Options.PARAM, Options.INTPARAM, Options.PARAMLIST): if short: short = short + ':' - if long: long = long + '=' + if long: + long = long + '=' + if string.find(long, '_') >= 0: + longs.append(string.replace(long, '_', '-')) shorts = shorts + short longs.append(long) self.short_opts = shorts @@ -92,6 +95,7 @@ class Options: return self.lookup_option(key, self.short) def lookup_long(self, key): + key = string.replace(key, '-', '_') return self.lookup_option(key, self.long) def handle_opts(self, opts):