Parse CLI command, arguments, and flags from a string
npm install @namchee/parsleyParse CLI command, arguments, and flags from a string.
You can install this package using your favorite package manager:
``bashUsing npm
npm install @namchee/parsley
API
$3
Parse command line arguments from a string and extract the command, arguments, and flags.
$3
-
command - The CLI command you want to parse.$3
-
CLICommand - Extracted CLI command$3
-
InvalidFlagError - Thrown when the parser tries to parse invalid CLI command.Types
$3
Extracted CLI command including its arguments and flags. Returned by
parseCLI function.#### Properties
-
command - The program that's called by this command
- args - Command line arguments
- flags - List of command line flags with their valuesErrors
$3
Thrown when the parser encounters unclosed flag quotation or incorrect positional argument position, such as when the positional argument is provided after flag definition.
FAQ
$3
1. This package works in any environment that runs JavaScript
2. This package doesn't need pre-defined options to parse CLI command
$3
1. This package doesn't support pre-defined template other than flag aliases
2. This package doesn't automatically read your arguments and parse it, you must provide the string yourself.
TL;DR: This is a more primitive package of CLI builders that only support simple parsing of commands.
$3
No, split it yourself for now. However if there is a demand for it, I'll consider it.
$3
Not at the moment. However if there is a demand for it, I'll consider it.
$3
parsecli` sounds similar to ParsleyThis project is licensed under the MIT License