Argv Alias to exec.
Epilogue Alias to epilog.
Gets help, completion script, completions, options...
the name of the command to find.
the path/name of executable.
the template string.
optional command to show help for.
the option key to get.
Listen : Alias for exec.
Removes elements and objects.
the command key/name to be removed.
Methods for setting values.
the key or PargvOptions object to be set.
the value for the provided key.
Shows help, completion script or env.
the path/name of executable.
the template string.
optional command to show help for.
Action Adds an action event to be called when parsing matches command.
the callback function when parsed command matches.
Base : Sets a base path for all external scripts that contain extentions.
a base path for ALL external command scripts.
Build Help Common method to get help before show or return.
optional command to get help for.
Coerce Coerce or transform each sub command argument or option in config object for default command.
object containing coerce configurations.
Command A string containing Parv tokens to be parsed.
the command token string to parse.
a description describing the command.
Compatibility Ensures compatibility with deprecated properties.
the key or object to map.
when true deprecation message is logged.
Compile Help Compiles help for all commands or single defined commnand.
the optional command to build help for.
Completion : Adds the completion command for use within your app for generating completion script.
the name of the commpletion install command.
the optional completion handler.
Completion At : Injects custom completion value for specified key. Key can be a known sub command argument option or * for anonymous.
the key to inject completion values for.
the completion values for the provided key.
Completion Result Method called maually or by script stored in your bash profile.
the Pargv parsed result, array of values or string (current line).
the callback on done compiling completions.
Default Sets a default value for specified sub command argument or option in default command.
an object containing configs for property defaults.
Default Sets a default value for specified sub command argument or option in default command.
the key to set default value for.
the value to set for the provided key.
Demand The sub command argument or option keys to be demanded for default command.
Describe Adds description for default command sub command argument or option.
object containing describes by property.
Describe Adds description for default command sub command argument or option.
the option key to add description to.
the associated description.
Description Adds description to help header.
the description string.
Epilog Displays trailing message.
the trailing epilogue to be displayed.
Error : Handles error messages.
args to be formatted and logged.
Error Handler The default error handler.
the PargvError instance.
Example : Saves an example string/tuple of example string & description for default command.
string or an array of tuples [example, description].
the description for the example.
Exec Parses arguments then executes command action if any.
optional arguments otherwise defaults to process.argv.
Extend Aliases When true option aliases are extended on result object --option, -o results in { option: value, o: value }.
when true aliases are exteneded on Pargv result object.
Logger Formats messages for logging.
log arguments.
Command : Finds a command by name.
the name of the command to find.
Get Completion : Gets the completion script.
the path/name of executable.
the template string.
Help : Gets help text.
optional command to show help for.
Option : Gets an option value by the specified key.
the option key to get.
Help Enables or disables help for default command.
true or false to toggle help.
Help Handler The default help handler.
optional command to get help for.
Init Common method to initialize Pargv also used in .reset().
the Pargv options object.
Layout Creates a CLI layout much like creating divs in the terminal.
the width of the layout.
if the layout should wrap.
License Adds license to help header.
the license type.
Log Displays log messages after formatting, supports metadata.
the arguments to log.
Log Handler : Handles internal log messages.
the message to be logged.
Max Options Specifies the maxium options allowed for default command.
the number of options allowed.
Meta Enables adding metadata to your header.
the metadata object.
Meta Enables adding metadata to your header.
the key to be added.
the value for key, if undefined will try to lookup from package.json.
Min Options Specifies the minimum options required for default command.
the number of options required.
Name Adds name of CLI to help header.
the value to use as app name.
an ansi color/style or array of styles. (DEPRECATED)
a Figlet font. (DEPRECATED)
On Error Add custom on error handler.
the error handler function.
On Help Method for adding custom help handler, disabling. If custom handler return compiled help to be displayed or false to handle manually.
boolean to enable/disable, or function for custom help.
On Log Add custom on log handler.
the log handler function.
Option Adds option to default command.
Supported types: string, date, array, number, integer, float, json, regexp, boolean
the option token to parse as option.
the description for the option.
an optional default value.
a string type, RegExp to match or Coerce method.
Parse Parses the provided arguments inspecting for commands and options.
the process.argv or custom args array.
Remove Removes a command from the collection.
the command key/name to be removed.
Reset Clears all defined commands as well as custom handlers and metadata.
when true resets metadata, base, help handler if set.
Reset Clears all commands and optionally resets custom handlers and metadata.
Pargv options to reset with.
when true resets metadata, base, help handler if set.
Option : Sets an option or group of options.
the key or PargvOptions object to be set.
the value for the provided key.
Completion Shows the completion script in terminal.
the path/name of executable.
the template string.
Help Shows help in terminal.
optional command to show help for.
Spawn Spawns a new child process, used by spawnHandler internally.
the program to be spawned.
the arguments to pass to the child process.
whether should exit on close.
Spawn Spawns a new child process, used by spawnHandler internally.
the program to be spawned.
the arguments to pass to the child process.
the spawn options.
whether should exit on close.
Spawn : Spawns and executes and external command.
the parsed command result.
a PargvCommand instance.
optional stdio for child process.
indicates if should exit after process.
Stats Iterates array of arguments comparing to defined configuration. To get stats from default command use 'default' as key name.
the command key to get stats for.
args to gets stats for.
Normalize Args Converts -abc to -a -b -c Converts --name=bob to --name bob
the arguments to normalize.
Usage Usage is generated automatically, this method allows override of the internal generated usage for default command.
the value to display for command usage.
Version Adds version to help header.
the value to use as version name.
When When a specified key in config object demand dependent key for default command.
an object containing when configurations.
When When a specified key demand dependent key for default command.
require this key.
when true the coverse when is also created.
When When a specified key demand dependent key for default command.
require this key.
this key is present.
when true the coverse when is also created.
Generated using TypeDoc
use pargv.command()
Default Command Exposes default command for parsing anonymous arguments.
pargv.$.option('-t').parse(['one', '-t', 'test'])