v0.2.1
A Deno module to parse command line with better standard.
Repository
Current version released
4 years ago
Command Line Parser (Deno Edition)
CommandLineParser.Deno - A Deno module to parse command line with better standard.
| Release | Latest | Pre |
|---|---|---|
| GitHub |
π Description
For NodeJS edition, please visit here.
π Feature
- Easier to remember which is flag and which is option (i.e.: key-value pair).
- Native support for TypeScript.
π Documentation
Getting Started
Deno (>= v1.11.0):
import commandLineParser from "https://deno.land/x/hugoalh_command_line_parser@<Tag/Version>/main.ts"API
(commandLine?)
Description
Parse command line.
Argument
commandLine?
<string[] = Deno.args> Command line that need to parse.
Return
<object> Parse result.
action:<string[]>fault:<string[]>Unparseable argument.flag:<string[]>Flag.option:<object>Key-value pair.
Example
import commandLineParser from "https://deno.land/x/hugoalh_command_line_parser@v0.1.3/main.ts"
console.log(commandLineParser(["-test", "--message=\"Hello, world!\"", "lol", "---fail"]));
/*
{
action: [
"lol"
],
fault: [
"---fail"
],
flag: [
"test"
],
option: {
message: "Hello, world!"
}
}
*/