]> Git trees. - libqmvoc.git/commitdiff
allow converter to write csv files, also show usage if no options or --help are specified
authorJeremy Paul Whiting <jpwhiting@kde.org>
Sat, 17 Nov 2007 15:58:58 +0000 (15:58 +0000)
committerJeremy Paul Whiting <jpwhiting@kde.org>
Sat, 17 Nov 2007 15:58:58 +0000 (15:58 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=737996

keduvocdocument/tests/converter.cpp

index 79cf509928210c9a906a3c24859d6d0cd3524d29..d7730fd5b19d678ea35e38b12be7215893a0cc3d 100644 (file)
@@ -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 <format>");
-    options.add( "+infile" );
-    options.add( "+outfile" );
+    options.add( "f <format>", 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();