From: Thomas Fehr Date: Thu, 13 Jan 2011 13:28:44 +0000 (+0100) Subject: rename command show to diff, fix bug handling current X-Git-Tag: v0.1.3~552 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f602640ac207709a4bcb7e73e3997a2f1758ffe7;p=thirdparty%2Fsnapper.git rename command show to diff, fix bug handling current --- diff --git a/cli/cli.cc b/cli/cli.cc index bb10fcd9..a2803186 100644 --- a/cli/cli.cc +++ b/cli/cli.cc @@ -69,12 +69,36 @@ void showDifference( const list& args ) unsigned n2 = 0; list::const_iterator s = args.begin(); if( s!=args.end() ) + { if( *s != "CURRENT" ) - *s++ >> n1; + *s >> n1; + ++s; + } if( s!=args.end() ) + { if( *s != "CURRENT" ) - *s++ >> n2; + *s >> n2; + ++s; + } y2mil( "n1:" << n1 << " n2:" << n2 ); + Snapshot sn; + bool ok = true; + if( n1>0 && !getSnapshot( n1, sn )) + { + cerr << "No snapshot with number " << n1 << endl; + ok = false; + } + if( n2>0 && !getSnapshot( n2, sn )) + { + cerr << "No snapshot with number " << n2 << endl; + ok = false; + } + if( ok ) + { + string p1 = (n1==0) ? "/" : "/snapshots/" + decString(n1); + string p2 = (n2==0) ? "/" : "/snapshots/" + decString(n2); + y2mil( "p1:" << p1 << " p2:" << p2 ); + } } int @@ -104,7 +128,7 @@ main(int argc, char** argv) cmds["list"] = listSnap; cmds["help"] = showHelp; cmds["create"] = createSnap; - cmds["show"] = showDifference; + cmds["diff"] = showDifference; for( int i=0; i