[CRIU] [PATCH] crit: enable --pretty by default

Ruslan Kuprieiev kupruser at gmail.com
Tue Jul 21 10:57:26 PDT 2015


Hi Tycho,

We did that on purpose, as we thought that crit should be used in various
scripts and they might be not happy with --pretty option, as it does some
unusual transformations with data(i.e. int to string in hex) which scripts
might be not happy about, as they use json tools(i.e. they might expect int
but get string in hex format).

I'm not sure that we should enable it always by default.
That being said, I believe we used to have "pretty for stdout by default"
behavior and I can't remember why it is gone. Though, we might
think of resurrecting it.

Pavel?

Thanks,
Ruslan

On 07/21/2015 08:06 PM, Tycho Andersen wrote:
> This is probably what everyone wants anyway :). This patch also adds a
> --no-pretty option if people really want to disable it.
>
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> ---
>   crit | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/crit b/crit
> index 350362c..3d0ee04 100755
> --- a/crit
> +++ b/crit
> @@ -52,15 +52,20 @@ def main():
>   	decode_parser = subparsers.add_parser('decode',
>   			help = 'convert criu image from binary type json')
>   	decode_parser.add_argument('--pretty',
> +			dest = 'pretty',
>   			help = 'Multiline with indents and some numerical fields in field-specific format',
>   			action = 'store_true')
> +	decode_parser.add_argument('--no-pretty',
> +			dest = 'pretty',
> +			help = 'Disable indenting and formatting.',
> +			action = 'store_false')
>   	decode_parser.add_argument('-i',
>   			    '--in',
>   			help = 'criu image in binary format to be decoded (stdin by default)')
>   	decode_parser.add_argument('-o',
>   			    '--out',
>   			help = 'where to put criu image in json format (stdout by default)')
> -	decode_parser.set_defaults(func=decode)
> +	decode_parser.set_defaults(func=decode, pretty=True)
>   
>   	# Encode
>   	encode_parser = subparsers.add_parser('encode',



More information about the CRIU mailing list