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

Tycho Andersen tycho.andersen at canonical.com
Tue Jul 21 11:06:44 PDT 2015


On Tue, Jul 21, 2015 at 08:57:26PM +0300, Ruslan Kuprieiev wrote:
> 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.

You mean "pretty when stdout is a terminal"? That sounds ok with me,
all I'm trying to do is avoid having to type --pretty when I use crit
to inspect the images :)

I know this will break things, but I was hoping it might be early
enough in the lifetime that there weren't a lot of scripts around that
depend on it.

Tycho

> 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