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
Many CLI options are meant to be paths to files. Instead of having to use string as type today, and doing the basic file handling in your app, it would be nice to have a dedicated file type for options in yargs.
If an option is of type file yargs would:
check if the file exists and if not throw an error with a standard message
run it through path.resolve() and return that as option value to the app
make bash autocompletion support expect a file here so that -f <TAB> will present available files
This new option would mean these API additions:
file(key)
option[s](key, opt) would take a new opt.file boolean, as well as support 'file' as value for opt.type
The text was updated successfully, but these errors were encountered:
Many CLI options are meant to be paths to files. Instead of having to use
string
as type today, and doing the basic file handling in your app, it would be nice to have a dedicatedfile
type for options in yargs.If an option is of type
file
yargs would:path.resolve()
and return that as option value to the app-f <TAB>
will present available filesThis new option would mean these API additions:
file(key)
option[s](key, opt)
would take a newopt.file
boolean, as well as support'file'
as value foropt.type
The text was updated successfully, but these errors were encountered: