Skip to content

Commit

Permalink
Merge pull request #130 from clydeclements/fix-save-config-for-nargs
Browse files Browse the repository at this point in the history
Fix saving config file for options with multiple arguments.
  • Loading branch information
bw2 authored Jan 13, 2019
2 parents 2c743df + 7bd64f9 commit a821c8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 0 additions & 4 deletions configargparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,6 @@ def get_items_for_config_file_output(self, source_to_settings,
if value is not None:
if isinstance(value, bool):
value = str(value).lower()
elif callable(action.type):
found = [i for i in range(0, len(existing_command_line_args)-1) if existing_command_line_args[i] in config_file_keys]
if found:
value = existing_command_line_args[found[-1] + 1]
config_file_items[config_file_keys[0]] = value

elif source == _ENV_VAR_SOURCE_KEY:
Expand Down
3 changes: 3 additions & 0 deletions tests/test_configargparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,9 @@ class CustomClass(object):
def __init__(self, name):
self.name = name

def __str__(self):
return self.name

@staticmethod
def valid_custom(s):
if s == "invalid": raise Exception("invalid name")
Expand Down

0 comments on commit a821c8e

Please sign in to comment.