[CRIU] [PATCH 4/6] crit: add --format hex option
Pavel Emelyanov
xemul at parallels.com
Mon Jan 19 04:33:13 PST 2015
On 01/16/2015 11:55 PM, Ruslan Kuprieiev wrote:
> hex option could be combined with other options(i.e. --format nice hex).
>
> Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
> ---
> crit | 14 +++++++++-----
> pycriu/images/images.py | 24 ++++++++++++------------
> pycriu/images/pb2dict.py | 29 ++++++++++++++++++++++-------
> 3 files changed, 43 insertions(+), 24 deletions(-)
>
> diff --git a/crit b/crit
> index e5d9b08..0b1671c 100755
> --- a/crit
> +++ b/crit
> @@ -7,7 +7,7 @@ import pycriu
>
> def handle_cmdline_opts():
> desc = 'CRiu Image Tool'
> - parser = argparse.ArgumentParser(description=desc)
> + parser = argparse.ArgumentParser(description=desc, formatter_class=argparse.RawTextHelpFormatter)
> parser.add_argument('command',
> choices = ['decode', 'encode'],
> help = 'decode/encode - convert criu image from/to binary type to/from json')
> @@ -19,8 +19,12 @@ def handle_cmdline_opts():
> help = 'output file (stdout by default)')
> parser.add_argument('-f',
> '--format',
> - choices = ['raw', 'nice'],
> - help = 'well-formated output (by default: raw for files and nice for stdout)')
> + choices = ['raw', 'nice', 'hex'],
> + nargs = '+',
> + default = [],
> + help = 'raw - all in one line\n'\
> + 'nice - add indents and newlines to look nice(default for stdout)\n'\
> + 'hex - print int fields as hex strings where suitable(could be combined with others)')
>
The usage for -f becomes
crit -f raw hex
This is somehow non-standard as the "hex" becomes dangling option. More typical is to
combine several choices for one option with commas, like
crit -f raw,hex
Can it be done like that?
More information about the CRIU
mailing list