X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dd18cc6594b47ee51001b309c62744b1ed8419c7..eea4d01c65f9b29baa1193db762b4c6b8144af24:/src/common/cmdline.cpp diff --git a/src/common/cmdline.cpp b/src/common/cmdline.cpp index 4abba86ee8..2952c2d6ae 100644 --- a/src/common/cmdline.cpp +++ b/src/common/cmdline.cpp @@ -707,11 +707,45 @@ int wxCmdLineParser::Parse(bool showUsage) if (longOptionsEnabled) { + wxString errorOpt; + optInd = m_data->FindOptionByLongName(name); if ( optInd == wxNOT_FOUND ) { - errorMsg << wxString::Format(_("Unknown long option '%s'"), name.c_str()) - << wxT('\n'); + // Check if this could be a negatable long option. + if ( name.Last() == '-' ) + { + name.RemoveLast(); + + optInd = m_data->FindOptionByLongName(name); + if ( optInd != wxNOT_FOUND ) + { + if ( !(m_data->m_options[optInd].flags & + wxCMD_LINE_SWITCH_NEGATABLE) ) + { + errorOpt.Printf + ( + _("Option '%s' can't be negated"), + name + ); + optInd = wxNOT_FOUND; + } + } + } + + if ( optInd == wxNOT_FOUND ) + { + if ( errorOpt.empty() ) + { + errorOpt.Printf + ( + _("Unknown long option '%s'"), + name + ); + } + + errorMsg << errorOpt << wxT('\n'); + } } } else