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
That is quite convenient if you want multiple aliases for a single option.
However, it creates some inconsistent behavior in the latest version with unnormalizedFlags. If you have more than one alias for a flag, those items (the flag and all aliases) get included in cli.flags as well as unnormalizedFlags. If there's only one alias (either a single element array or a plain string), the normal behavior of the alias being excluded from flags is observed.
The ability to pass in an array into aliases is admittedly an undocumented, if not unsupported, feature, but for me it's quite helpful. In particular it helps with backwards compatibility and gradual deprecation of flags that have been renamed. I can support both the old and new flag names for 1-2 versions while warning of the deprecation, without having to rewrite the underlying code.
The current behavior is not difficult to deal with, once known. I am seeking to raise awareness of the handling of alias arrays and propose that it become a documented and supported feature.
The text was updated successfully, but these errors were encountered:
When the
minimist-options
package parses aliases, it was apparently designed to handle both a single string as well as an array of strings (itarrify
s the alias and turns a single string into an array before processing). (This package was also written by @sindresorhus, but the originalminimist
handled aliases similarly.)That is quite convenient if you want multiple aliases for a single option.
However, it creates some inconsistent behavior in the latest version with
unnormalizedFlags
. If you have more than one alias for a flag, those items (the flag and all aliases) get included incli.flags
as well asunnormalizedFlags
. If there's only one alias (either a single element array or a plain string), the normal behavior of the alias being excluded fromflags
is observed.The ability to pass in an array into aliases is admittedly an undocumented, if not unsupported, feature, but for me it's quite helpful. In particular it helps with backwards compatibility and gradual deprecation of flags that have been renamed. I can support both the old and new flag names for 1-2 versions while warning of the deprecation, without having to rewrite the underlying code.
The current behavior is not difficult to deal with, once known. I am seeking to raise awareness of the handling of alias arrays and propose that it become a documented and supported feature.
The text was updated successfully, but these errors were encountered: