Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix @boegel's remarks ;-) #10

Merged
merged 7 commits into from
Oct 10, 2015

Conversation

boegel
Copy link

@boegel boegel commented Oct 9, 2015

@@ -855,11 +869,15 @@ def test_option_as_value(self):
self._match_testoption1_sysexit(['--store', '-b'],
"Value '-b' is also a valid option")

# same for --store=-b
self._match_testoption1_sysexit(['--store=-b'],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would this fail? this has to work since it's unambigous

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, indeed, that's also why my modified stuff doesn't pass the tests, will push another commit to fix this

@boegel
Copy link
Author

boegel commented Oct 10, 2015

@stdweird: updated, please check again, I removed the bogus test and implement support to recognise -sb etc. as a likely typo

@@ -488,7 +489,7 @@ def __init__(self, *args, **kwargs):
self.environment_arguments = None
self.commandline_arguments = None

def is_value_a_commandline_option(self, value, index=None):
def is_value_a_commandline_option(self, opt, value, index=None):
"""
Determine if value is/could be an option passed via the commandline.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add something describing opt

# This is not the value you are looking for
return None

if not self.ALLOW_OPTION_NAME_AS_VALUE:
if '-%s' % value in self._short_opt or '-%s' % value in self._long_opt:
return "'-%(val)s' is a valid option, so using '%(val)s' as value is likely a typo" % {'val': value}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the so using '%(val)s' as value is likely a typo it's not required (and none of the other error messages have it)

if not self.ALLOW_OPTION_NAME_AS_VALUE:
if '-%s' % value in self._short_opt or '-%s' % value in self._long_opt:
return "'-%(val)s' is a valid option, so using '%(val)s' as value is likely a typo" % {'val': value}

# First test the exact problem where the value is an option
if (not self.ALLOW_OPTION_AS_VALUE) and (value in self._long_opt or value in self._short_opt):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here value in self._long_opt + self._short_opt

stdweird added a commit that referenced this pull request Oct 10, 2015
@stdweird stdweird merged commit 1a4093b into stdweird:go_nooptionasvalue Oct 10, 2015
@stdweird
Copy link
Owner

@boegel thx a lot

@boegel boegel deleted the go_nooptionasvalue branch October 10, 2015 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants