All the TODO/WIP features:
Argument types:
Parsing
Argument features
Configurable features
Command features
Builtins
We should have a default implementation of these, with a mechanism to override.
At present, this can be implemented with a custom type which prints information and then exits.
However, this should be cleaner than just process.exit() in the coercer.
We should also have support for a "fallback" command, the command that gets run as a default if no recognised one is passed.
Perhaps these should have their own method?:
parser
.default('help', <Command>)
.default('fallback', <Command>)
.command(['cmd'], <Command>)
Short flag grouping
We should support grouping of short flags and the like. This should mean that we treat a "long" short flag (> 1 char) as a single flag if a matching one is found, or as a group of single flags if not. Something lke:
const short = "-abc"
const longShort = flags.get(short)
if (longShort) {
return longShort
}
const parts = short.split()
const flagsInGroup = []
for (const part of parts) {
const groupMember = flags.get(part)
if (!groupMember) {
// Error, unknown flag
}
flagsInGroup.push(groupMember)
}
return flagsInGroup
We should accumulate errors in the group stage so that we can present more useful information to the user.
This accumulation will mean parsing can return ParseError[] instead of ParseError (singular).
Shell completion
We should support this. Again, pluggable with sane defaults.
Suggest fixes for incorrect arguments
We should offer advice to users about which options are similar to their input. This should be a pluggable system as we do not want the project to have runtime dependencies, and developers may have their own taste / requirements for the system.
We will use a prefix tree internally as the default implementation, but the user can also plug their own in.
We can write tests based on a well known solution and provide examples for such.
Prompting support
Outside of Node
Localisation
We should support some sort of localisation, ideally without defaults [in other languages] due to maintenance burden,
but end users can provide their own
Type level testing
We should test our type system logic with something like tsd
All the TODO/WIP features:
Argument types:
--syntax), dumps into a named argument on the result (just a raw string with the rest of the arg string)Parsing
=in flags--flag=valueargv.slice(2))--no-[key](customisable prefix)Argument features
k=v)xis set, so musty(inverse dependency)Configurable features
=in flagsCommand features
Builtins
We should have a default implementation of these, with a mechanism to override.
At present, this can be implemented with a custom type which prints information and then exits.
However, this should be cleaner than just
process.exit()in the coercer.We should also have support for a "fallback" command, the command that gets run as a default if no recognised one is passed.
Perhaps these should have their own method?:
Short flag grouping
We should support grouping of short flags and the like. This should mean that we treat a "long" short flag (> 1 char) as a single flag if a matching one is found, or as a group of single flags if not. Something lke:
We should accumulate errors in the group stage so that we can present more useful information to the user.
This accumulation will mean parsing can return
ParseError[]instead ofParseError(singular).Shell completion
We should support this. Again, pluggable with sane defaults.
Suggest fixes for incorrect arguments
We should offer advice to users about which options are similar to their input. This should be a pluggable system as we do not want the project to have runtime dependencies, and developers may have their own taste / requirements for the system.
We will use a prefix tree internally as the default implementation, but the user can also plug their own in.
We can write tests based on a well known solution and provide examples for such.
Prompting support
This should work OOTB already, but we should add tests with something like
inquirer.Outside of Node
We should not use node specific tools in the default prelude. Node should be opt in.
We should make a platform type object that will house all the platform specific details, and patch those in the browser.
Localisation
We should support some sort of localisation, ideally without defaults [in other languages] due to maintenance burden,
but end users can provide their own
Type level testing
We should test our type system logic with something like tsd