From: Jeremy Paul Whiting Date: Sat, 17 Nov 2007 15:58:58 +0000 (+0000) Subject: allow converter to write csv files, also show usage if no options or --help are specified X-Git-Tag: v3.97.0~9 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=db800e71df2e03b934f683e902046dcf33337383;p=libqmvoc.git allow converter to write csv files, also show usage if no options or --help are specified svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=737996 --- diff --git a/keduvocdocument/tests/converter.cpp b/keduvocdocument/tests/converter.cpp index 79cf509..d7730fd 100644 --- a/keduvocdocument/tests/converter.cpp +++ b/keduvocdocument/tests/converter.cpp @@ -38,9 +38,9 @@ int main( int argc, char ** argv ) { KAboutData about( "kvtml-converter", 0, ki18n( "Kvtml-Converter" ), "0.1", ki18n( "kvtml file converter" ), KAboutData::License_GPL, ki18n( "© 2007 Jeremy Whiting" ) ); KCmdLineOptions options; - options.add( "f "); - options.add( "+infile" ); - options.add( "+outfile" ); + options.add( "f ", ki18n("file format to write out (kvtml1, kvtml2, or csv)")); + options.add( "+infile", ki18n( "file to read in" ) ); + options.add( "+outfile", ki18n( "file to write to" ) ); KCmdLineArgs::init( argc, argv, &about ); KCmdLineArgs::addCmdLineOptions( options ); @@ -60,12 +60,20 @@ int main( int argc, char ** argv ) { document.saveAs( outfile, KEduVocDocument::Kvtml1, "converter" ); } + else if (arguments->getOption("f") == "csv") + { + document.saveAs( outfile, KEduVocDocument::Csv, "converter" ); + } else { document.saveAs( outfile, KEduVocDocument::Kvtml, "converter" ); } } } + else + { + arguments->usage(); + } arguments->clear();