]> git.saurik.com Git - wxWidgets.git/commitdiff
accept "--opt val" and "--opt:val" syntax in addition to "--opt=val" as
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 20 Oct 2007 21:08:38 +0000 (21:08 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 20 Oct 2007 21:08:38 +0000 (21:08 +0000)
documented (patch 1786465)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49275 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/cmdline.cpp

index 88d22ca1848ced79f051eec0e2a943cc288cac1f..45246ccb103b4d779bea8f80afc7f88538bbf601 100644 (file)
@@ -716,58 +716,44 @@ int wxCmdLineParser::Parse(bool showUsage)
             }
             else // it's an option. not a switch
             {
-                // get the value
-                if ( isLong )
+                switch ( (*p).GetValue() )
                 {
-                    if ( *p++ != _T('=') )
-                    {
-                        errorMsg << wxString::Format(_("Option '%s' requires a value, '=' expected."), name.c_str())
-                                 << _T('\n');
-
-                        ok = false;
-                    }
-                }
-                else // short option
-                {
-                    switch ( (*p).GetValue() )
-                    {
-                        case _T('='):
-                        case _T(':'):
-                            // the value follows
-                            ++p;
-                            break;
-
-                        case 0:
-                            // the value is in the next argument
-                            if ( ++n == count )
-                            {
-                                // ... but there is none
-                                errorMsg << wxString::Format(_("Option '%s' requires a value."),
-                                                             name.c_str())
-                                         << _T('\n');
-
-                                ok = false;
-                            }
-                            else
-                            {
-                                // ... take it from there
-                                p = m_data->m_arguments[n].begin();
-                                end = m_data->m_arguments[n].end();
-                            }
-                            break;
+                    case _T('='):
+                    case _T(':'):
+                        // the value follows
+                        ++p;
+                        break;
 
-                        default:
-                            // the value is right here: this may be legal or
-                            // not depending on the option style
-                            if ( opt.flags & wxCMD_LINE_NEEDS_SEPARATOR )
-                            {
-                                errorMsg << wxString::Format(_("Separator expected after the option '%s'."),
-                                                             name.c_str())
-                                        << _T('\n');
+                    case 0:
+                        // the value is in the next argument
+                        if ( ++n == count )
+                        {
+                            // ... but there is none
+                            errorMsg << wxString::Format(_("Option '%s' requires a value."),
+                                                         name.c_str())
+                                     << _T('\n');
+
+                            ok = false;
+                        }
+                        else
+                        {
+                            // ... take it from there
+                            p = m_data->m_arguments[n].begin();
+                            end = m_data->m_arguments[n].end();
+                        }
+                        break;
 
-                                ok = false;
-                            }
-                    }
+                    default:
+                        // the value is right here: this may be legal or
+                        // not depending on the option style
+                        if ( opt.flags & wxCMD_LINE_NEEDS_SEPARATOR )
+                        {
+                            errorMsg << wxString::Format(_("Separator expected after the option '%s'."),
+                                                         name.c_str())
+                                    << _T('\n');
+
+                            ok = false;
+                        }
                 }
 
                 if ( ok )