Commit 582f935e authored by Michael Reeves's avatar Michael Reeves

fix argument processing

parent 7b87b69a
......@@ -152,7 +152,8 @@ KDiff3App::KDiff3App( QWidget* pParent, const char* /*name*/, KDiff3Part* pKDiff
//TODO: Port to KF5/qt5
// Option handling: Only when pParent==0 (no parent)
bool hasArgs = !isPart() && KDiff3Shell::getParser()->optionNames().count() > 0;
int argCount = KDiff3Shell::getParser()->optionNames().count() + KDiff3Shell::getParser()->positionalArguments().count();
bool hasArgs = !isPart() && argCount > 0;
if( hasArgs ) {
QString s;
QString title;
......@@ -164,7 +165,7 @@ KDiff3App::KDiff3App( QWidget* pParent, const char* /*name*/, KDiff3Part* pKDiff
s = m_pOptionDialog->parseOptions( KDiff3Shell::getParser()->values( "cs" ) );
title = i18n( "Config Option Error:" );
}
if( !s.isEmpty() ) {
if( !s.isEmpty() ) {//TODO: Why use the dialog only on windows?
#if defined(_WIN32) || defined(Q_OS_OS2)
// A windows program has no console
//KMessageBox::information(0, s,i18n("KDiff3-Usage"));
......@@ -231,8 +232,8 @@ KDiff3App::KDiff3App( QWidget* pParent, const char* /*name*/, KDiff3Part* pKDiff
if( args.count() > 0 ) m_sd2.setFilename( args[0] );
if( args.count() > 1 ) m_sd3.setFilename( args[1] );
}
QStringList aliasList = KDiff3Shell::getParser()->values( "fname" );
//never properly defined and redundant
QStringList aliasList;//KDiff3Shell::getParser()->values( "fname" );
QStringList::Iterator ali = aliasList.begin();
QString an1 = KDiff3Shell::getParser()->value( "L1" );
......
......@@ -204,18 +204,18 @@ int main( int argc, char *argv[] ) {
initialiseCmdLineArgs( );
// ignorable command options
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "m" ) << QLatin1String( "merge" ), i18n( "Merge the input." ) ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "b" ) << QLatin1String( "base file" ), i18n( "Explicit base file. For compatibility with certain tools." ) ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "o" ) << QLatin1String( "output file" ), i18n( "Output file. Implies -m. E.g.: -o newfile.txt" ) ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "out file" ), i18n( "Output file, again. (For compatibility with certain tools.)" ) ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "b" ) << QLatin1String( "base" ), i18n( "Explicit base file. For compatibility with certain tools." ), QLatin1String("file") ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "o" ) << QLatin1String( "output" ), i18n( "Output file. Implies -m. E.g.: -o newfile.txt" ), QLatin1String("file") ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "out" ), i18n( "Output file, again. (For compatibility with certain tools.)" ) , QLatin1String("file") ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "auto" ), i18n( "No GUI if all conflicts are auto-solvable. (Needs -o file)" ) ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "qall" ), i18n( "Don't solve conflicts automatically." ) ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "L1 alias1" ), i18n( "Visible name replacement for input file 1 (base)." ) ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "L2 alias2" ), i18n( "Visible name replacement for input file 2." ) ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "L3 alias3" ), i18n( "Visible name replacement for input file 3." ) ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "L1" ), i18n( "Visible name replacement for input file 1 (base)." ), QLatin1String("alias1") ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "L2" ), i18n( "Visible name replacement for input file 2." ), QLatin1String("alias2") ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "L3" ), i18n( "Visible name replacement for input file 3." ), QLatin1String("alias3") ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "L" ) << QLatin1String( "fname alias" ), i18n( "Alternative visible name replacement. Supply this once for every input." ) ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "cs string" ), i18n( "Override a config setting. Use once for every setting. E.g.: --cs \"AutoAdvance=1\"" ) ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "cs" ), i18n( "Override a config setting. Use once for every setting. E.g.: --cs \"AutoAdvance=1\"" ), QLatin1String("string") ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "confighelp" ), i18n( "Show list of config settings and current values." ) ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "config file" ), i18n( "Use a different config file." ) ) );
KDiff3Shell::getParser()->addOption( QCommandLineOption( QStringList() << QLatin1String( "config" ), i18n( "Use a different config file." ), QLatin1String("file") ) );
// other command options
KDiff3Shell::getParser()->addPositionalArgument( QLatin1String( "[File1]" ), i18n( "file1 to open (base, if not specified via --base)" ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment