Skip to content

Commit 936ed95

Browse files
committed
Fix test
1 parent 8e86518 commit 936ed95

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

jsonargparse/_parameter_resolvers.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,15 @@ class ParamData:
5050
def _resolve_args_and_dest(self, is_required=False, as_positional=False, nested_key: Optional[str] = None):
5151
name = self.name
5252
dest = (nested_key + "." if nested_key else "") + name
53-
args = [dest if is_required and as_positional else "--" + dest]
54-
long_names = [name] + list((self.long_aliases or []))
55-
short_names = list(self.short_aliases or [])
56-
# if fuzzy_hyphens:
57-
# # Do we want to allow for people to use hyphens on the CLI?
58-
# # Maybe, we can make it optional.
59-
# unique_long_names = set(long_names)
60-
# modified_long_names = {n.replace('_', '-') for n in unique_long_names}
61-
# extra_long_names = modified_long_names - unique_long_names
62-
# long_names += sorted(extra_long_names)
63-
nest_prefix = nested_key + "." if nested_key else ""
64-
short_option_strings = ["-" + nest_prefix + n for n in short_names]
65-
long_option_strings = ["--" + nest_prefix + n for n in long_names]
66-
args = short_option_strings + long_option_strings
53+
if is_required and as_positional:
54+
args = [dest]
55+
else:
56+
long_names = [name] + list((self.long_aliases or []))
57+
short_names = list(self.short_aliases or [])
58+
nest_prefix = nested_key + "." if nested_key else ""
59+
short_option_strings = ["-" + nest_prefix + n for n in short_names]
60+
long_option_strings = ["--" + nest_prefix + n for n in long_names]
61+
args = short_option_strings + long_option_strings
6762
return args, dest
6863

6964

0 commit comments

Comments
 (0)