program
.command("split")
.description("Split a string into substrings and display as an array")
.argument("<string>", "string to split")
.option("--first", "display just the first substring")
.option("-s ,--separator <char>", "separator character", ",")
.action((str, options) => {
console.log(options);
const limit = options.first ? 1 : undefined;
console.log(str.split(options.separator, limit));
});
-s="l" is parsed as {seperator:"=l"}
--seperator="l" is parsed as {seperator :"l"}
how to get uniform parsing either as "=l" or "l" while using both short and long flags
The supported forms for specifying an option and option-argument in Commander are
There is not support in Commander for making the short and long options "uniform" for the combined option and value form.
The short form comes from POSIX and GNU guidelines.
POSIX Utility Conventions
GNU Program Argument Syntax Conventions
(I am a maintainer of Commander.)