-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Clay - Deno Command Line Parser | ||
|
||
Easily convert command line arguments to objects. | ||
|
||
## Examples | ||
|
||
A simple command with two options, one of which is required. | ||
```ts | ||
import { Command, string, number } from "https://deno.land/x/clay/mod.ts"; | ||
|
||
const cmd = new Command("A simple example.") | ||
.required(string, "name", { flags: ["n", "name"], description: "The name." }) | ||
.optional(number, "age", { flags: ["a", "age"], description: "The age." }); | ||
|
||
console.log(cmd.run()); // { name: string, age: number | null } | ||
``` | ||
|
||
Simple yes / no flag options are supported as well. | ||
```ts | ||
import { Command, string, number } from "https://deno.land/x/clay/mod.ts"; | ||
|
||
const cmd = new Command("A simple example.") | ||
.required(string, "file") | ||
.flag("overwrite", { aliases: ["o"], description: "Overwrite the file." }); | ||
|
||
console.log(cmd.run()); // { file: string, overwrite: boolean } | ||
``` |
File renamed without changes.