[GitHub] commons-cli issue #14: Added BugCLI260 JUnit Test

2017-07-09 Thread jlm429
Github user jlm429 commented on the issue:

https://github.com/apache/commons-cli/pull/14
  
Just adding this diff from the code above if needed for future reference.  
this pr can be closed - do we possibly need more committers for CLI?  It 
doesn't seem like anyone is paying attention to the 2 that are open... 

@@ -540,10 +539,32 @@ else if (isJavaProperty(t))
 String opt = t.substring(0, pos);
 String value = t.substring(pos + 1);
 
-if (opt.length() == 1)
+  //check if equal is in argument (-option"test=arg")
+  // -L=V
+  // if (opt.length()>1 && !options.hasOption(opt))
+  {
+//Search for long option and use correct option/argument if 
found
+String newOpt=getLongPrefix(opt);
+if (newOpt!=null)
+{
+  pos = newOpt.length();
+  opt = t.substring(0, pos);
+  value = t.substring(pos);
+}
+//check if equal is in argument (-o"test=arg") and use correct 
short option if found
+// -S=V
+else if (options.hasOption(opt.substring(0,1)) && 
!opt.substring(1,2).contains("="))
+{
+  opt = t.substring(0, 1);
+  value = t.substring(1);
+}
+  }
+
+
+  if (opt.length() == 1)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-cli issue #14: Added BugCLI260 JUnit Test

2017-07-09 Thread jlm429
Github user jlm429 commented on the issue:

https://github.com/apache/commons-cli/pull/14
  
Just adding this diff from the code above if needed for future reference.  
this pr can be closed - do we possibly need more committers for CLI?  It 
doesn't seem like anyone is paying attention to the 2 that are open... 

@@ -540,10 +539,32 @@ else if (isJavaProperty(t))
 String opt = t.substring(0, pos);
 String value = t.substring(pos + 1);
 
-if (opt.length() == 1)
+  //check if equal is in argument (-option"test=arg")
+  // -L=V
+  // if (opt.length()>1 && !options.hasOption(opt))
+  {
+//Search for long option and use correct option/argument if 
found
+String newOpt=getLongPrefix(opt);
+if (newOpt!=null)
+{
+  pos = newOpt.length();
+  opt = t.substring(0, pos);
+  value = t.substring(pos);
+}
+//check if equal is in argument (-o"test=arg") and use correct 
short option if found
+// -S=V
+else if (options.hasOption(opt.substring(0,1)) && 
!opt.substring(1,2).contains("="))
+{
+  opt = t.substring(0, 1);
+  value = t.substring(1);
+}
+  }
+
+
+  if (opt.length() == 1)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-cli issue #14: Added BugCLI260 JUnit Test

2017-06-19 Thread jlm429
Github user jlm429 commented on the issue:

https://github.com/apache/commons-cli/pull/14
  
fwiw - this is what I had to fix ... probably better off not digging around 
in the default parser though if not needed :0

private void handleShortAndLongOption(String token) throws 
ParseException
{
String t = Util.stripLeadingHyphens(token);

int pos = t.indexOf('=');

if (t.length() == 1)
{
// -S
if (options.hasShortOption(t))
{
handleOption(options.getOption(t));
}
else
{
handleUnknownToken(token);
}
}
else if (pos == -1)
{
// no equal sign found (-xxx)
if (options.hasShortOption(t))
{
handleOption(options.getOption(t));
}
else if (!options.getMatchingOptions(t).isEmpty())
{
// -L or -l
handleLongOptionWithoutEqual(token);
}
else
{
// look for a long prefix (-Xmx512m)
String opt = getLongPrefix(t);

if (opt != null && options.getOption(opt).acceptsArg())
{
handleOption(options.getOption(opt));

currentOption.addValueForProcessing(t.substring(opt.length()));
currentOption = null;
}
else if (isJavaProperty(t))
{
// -SV1 (-Dflag)
handleOption(options.getOption(t.substring(0, 1)));
currentOption.addValueForProcessing(t.substring(1));
currentOption = null;
}
else
{
// -S1S2S3 or -S1S2V
handleConcatenatedOptions(token);
}
}
}
else
{
// equal sign found (-xxx=yyy)
String opt = t.substring(0, pos);
String value = t.substring(pos + 1);

//check if equal is in argument (-option"test=arg")
// -L=V
if (opt.length()>1 && !options.hasOption(opt))
{
//Search for long option and use correct option/argument if 
found
String newOpt=getLongPrefix(opt);
if (newOpt!=null)
{
  pos = newOpt.length();
  opt = t.substring(0, pos);
  value = t.substring(pos);
}
//check if equal is in argument (-o"test=arg") and use 
correct short option if found
// -S=V
else if (options.hasOption(opt.substring(0,1)) && 
!opt.substring(1,2).contains("="))
{
 opt = t.substring(0, 1);
 value = t.substring(1);
   }
}




if (opt.length() == 1)
{
// -S=V
Option option = options.getOption(opt);
if (option != null && option.acceptsArg())
{
handleOption(option);
currentOption.addValueForProcessing(value);
currentOption = null;
}
else
{
handleUnknownToken(token);
}
}
else if (isJavaProperty(opt))
{
// -SV1=V2 (-Dkey=value)
handleOption(options.getOption(opt.substring(0, 1)));
currentOption.addValueForProcessing(opt.substring(1));
currentOption.addValueForProcessing(value);
currentOption = null;
}
else
{
// -L=V or -l=V
handleLongOptionWithEqual(token);
}
}
}



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-cli issue #14: Added BugCLI260 JUnit Test

2017-06-19 Thread jlm429
Github user jlm429 commented on the issue:

https://github.com/apache/commons-cli/pull/14
  
fwiw - this is what I had to fix ... probably better off not digging around 
in the default parser though if not needed :0

private void handleShortAndLongOption(String token) throws 
ParseException
{
String t = Util.stripLeadingHyphens(token);

int pos = t.indexOf('=');

if (t.length() == 1)
{
// -S
if (options.hasShortOption(t))
{
handleOption(options.getOption(t));
}
else
{
handleUnknownToken(token);
}
}
else if (pos == -1)
{
// no equal sign found (-xxx)
if (options.hasShortOption(t))
{
handleOption(options.getOption(t));
}
else if (!options.getMatchingOptions(t).isEmpty())
{
// -L or -l
handleLongOptionWithoutEqual(token);
}
else
{
// look for a long prefix (-Xmx512m)
String opt = getLongPrefix(t);

if (opt != null && options.getOption(opt).acceptsArg())
{
handleOption(options.getOption(opt));

currentOption.addValueForProcessing(t.substring(opt.length()));
currentOption = null;
}
else if (isJavaProperty(t))
{
// -SV1 (-Dflag)
handleOption(options.getOption(t.substring(0, 1)));
currentOption.addValueForProcessing(t.substring(1));
currentOption = null;
}
else
{
// -S1S2S3 or -S1S2V
handleConcatenatedOptions(token);
}
}
}
else
{
// equal sign found (-xxx=yyy)
String opt = t.substring(0, pos);
String value = t.substring(pos + 1);

//check if equal is in argument (-option"test=arg")
// -L=V
if (opt.length()>1 && !options.hasOption(opt))
{
//Search for long option and use correct option/argument if 
found
String newOpt=getLongPrefix(opt);
if (newOpt!=null)
{
  pos = newOpt.length();
  opt = t.substring(0, pos);
  value = t.substring(pos);
}
//check if equal is in argument (-o"test=arg") and use 
correct short option if found
// -S=V
else if (options.hasOption(opt.substring(0,1)) && 
!opt.substring(1,2).contains("="))
{
 opt = t.substring(0, 1);
 value = t.substring(1);
   }
}




if (opt.length() == 1)
{
// -S=V
Option option = options.getOption(opt);
if (option != null && option.acceptsArg())
{
handleOption(option);
currentOption.addValueForProcessing(value);
currentOption = null;
}
else
{
handleUnknownToken(token);
}
}
else if (isJavaProperty(opt))
{
// -SV1=V2 (-Dkey=value)
handleOption(options.getOption(opt.substring(0, 1)));
currentOption.addValueForProcessing(opt.substring(1));
currentOption.addValueForProcessing(value);
currentOption = null;
}
else
{
// -L=V or -l=V
handleLongOptionWithEqual(token);
}
}
}



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-cli issue #14: Added BugCLI260 JUnit Test

2017-06-18 Thread jlm429
Github user jlm429 commented on the issue:

https://github.com/apache/commons-cli/pull/14
  
Yep, that works for me.  


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-cli issue #14: Added BugCLI260 JUnit Test

2017-06-18 Thread jlm429
Github user jlm429 commented on the issue:

https://github.com/apache/commons-cli/pull/14
  
Yep, that works for me.  


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-cli issue #14: Added BugCLI260 JUnit Test

2017-06-18 Thread jlm429
Github user jlm429 commented on the issue:

https://github.com/apache/commons-cli/pull/14
  
my bad... I guess it makes sense to wait to merge the test until the bug is 
fixed.  


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-cli issue #14: Added BugCLI260 JUnit Test

2017-06-18 Thread jlm429
Github user jlm429 commented on the issue:

https://github.com/apache/commons-cli/pull/14
  
my bad... I guess it makes sense to wait to merge the test until the bug is 
fixed.  


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-cli pull request #14: Added BugCLI260 JUnit Test

2017-06-17 Thread jlm429
GitHub user jlm429 opened a pull request:

https://github.com/apache/commons-cli/pull/14

Added BugCLI260 JUnit Test



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/jlm429/commons-cli master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-cli/pull/14.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #14


commit a2b142847c452f27462575cce3534ef534796b69
Author: John Mansfield <jmansfie...@gatech.edu>
Date:   2017-06-17T22:03:54Z

Added BugCLI260 JUnit Test




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org