Skip to content

Commit

Permalink
Start writing some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dyedgreen committed Dec 22, 2021
1 parent 3b055f9 commit 13cb2a0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
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.

0 comments on commit 13cb2a0

Please sign in to comment.