You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a switch or flag has both a short form (e.g, -a) and a long form (e.g., --annotate) option name, only the short form appears to work when used in the config file; the long form is ignored. When there is only a long form, it works okay in the config file.
It seems like either short or long form names should work in the config file. If anything, maybe there should be a preference for long form names for the sake of readability.
I think I tracked the problem down to the override_default method in AppSupport. The issue is that the token 'name' is just the short form name when both short and long exist.
I have a fix that seems to work for me, but is not maybe pull request worthy. So here it is for your consideration:
def override_default(tokens, config)
tokens.each do |name, token|
all_aliases = [token.name]
all_aliases += token.aliases if (token.aliases)
matches = config.keys & all_aliases # Could have multiple aliases in config file, i.e., over specified
if not matches.empty?
token.default_value = config[matches.last] # Use last match; should be last occurrence in config file, but not necessarily
end
end
end
The text was updated successfully, but these errors were encountered:
Yeah, the intention is for either to work. At one point there was a bug where initconfig would write both (or all) versions of a flag into the config file, thus making it appear to work with tests.
When a switch or flag has both a short form (e.g,
-a
) and a long form (e.g.,--annotate
) option name, only the short form appears to work when used in the config file; the long form is ignored. When there is only a long form, it works okay in the config file.It seems like either short or long form names should work in the config file. If anything, maybe there should be a preference for long form names for the sake of readability.
I think I tracked the problem down to the override_default method in AppSupport. The issue is that the token 'name' is just the short form name when both short and long exist.
I have a fix that seems to work for me, but is not maybe pull request worthy. So here it is for your consideration:
The text was updated successfully, but these errors were encountered: