Skip to content

Commit

Permalink
docs: update readme's
Browse files Browse the repository at this point in the history
  • Loading branch information
c4spar committed May 10, 2020
1 parent 6cd9d3f commit 7e549c9
Show file tree
Hide file tree
Showing 7 changed files with 271 additions and 52 deletions.
48 changes: 33 additions & 15 deletions README.md
@@ -1,12 +1,36 @@
# Cliffy - Command line framework for Deno

A collection of modules for creating interactive command line tools.

![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github) ![GitHub Release Date](https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github)

![Build Status](https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master) ![Deno version](https://img.shields.io/badge/deno-v1.0.0%20rc2-green?logo=deno) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/c4spar/deno-cliffy?logo=github) ![GitHub issues](https://img.shields.io/github/issues/c4spar/deno-cliffy?logo=github) ![GitHub licence](https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github)

**Included modules:**
<h1 align="center">❯ Cliffy</h1>

<p align="center">
<a href="https://github.com/c4spar/deno-cliffy/releases">
<img alt="Version" src="https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/releases">
<img alt="Release date" src="https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github" />
</a>
<a href="https://deno.land/">
<img alt="Deno version" src="https://img.shields.io/badge/deno-v0.42.0-green?logo=deno" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/actions?query=workflow%3Aci">
<img alt="Build status" src="https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/issues?q=is%3Aissue+is%3Aopen+label%3Amodule%3Acommand">
<img alt="issues" src="https://img.shields.io/github/issues/c4spar/deno-cliffy?label=issues&logo=github">
</a>
<a href="https://github.com/c4spar/deno-cliffy/actions?query=workflow%3Aci">
<img alt="Licence" src="https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github" />
</a>
</p>

<p align="center">
<b>Command line framework for Deno</b></br>
<sub>>_ A collection of modules for creating interactive command line tools.<sub>
</p>

<p align="center" style="color: #856404; background-color: #fff3cd; border-color: #ffeeba; padding: .75rem 1.25rem; margin-bottom: 1rem; border-radius: .25rem;">
<b>WARNING:</b> This project is still under development. Not all features are fully implemented and it's possible to get some breaking changes if you upgrade to a newer version. If you find a bug or have a feature request feel free to create an issue.
</p>

## Packages

* **[ansi-escape](packages/ansi-escape/):** Show, hide and move cli cursor, erase output and scroll window.

Expand All @@ -19,9 +43,3 @@ A collection of modules for creating interactive command line tools.
* **[prompt](packages/prompt/):** Create interactive prompts like: checkbox, confirm, input, number, select, etc...

* **[table](packages/table/):** Create cli table's with border, padding, nested table's, etc...

**Todo's:**

* **console:** Run a sub-shell with auto-completion and auto-suggestion for a specific command.

* ...
34 changes: 27 additions & 7 deletions packages/ansi-escape/README.md
@@ -1,10 +1,30 @@
# Cliffy - ANSI Escape

ANSI escape module for handling cli cursor, erase output and scroll window.

![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github) ![GitHub Release Date](https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github)

![Build Status](https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master) ![Deno version](https://img.shields.io/badge/deno-v1.0.0%20rc2-green?logo=deno) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/c4spar/deno-cliffy?logo=github) ![GitHub issues](https://img.shields.io/github/issues/c4spar/deno-cliffy?logo=github) ![GitHub licence](https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github)
<h1 align="center">Cliffy ❯ ANSI Escape</h1>

<p align="center">
<a href="https://github.com/c4spar/deno-cliffy/releases">
<img alt="Version" src="https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/releases">
<img alt="Release date" src="https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github" />
</a>
<a href="https://deno.land/">
<img alt="Deno version" src="https://img.shields.io/badge/deno-v1.0.0%20rc2-green?logo=deno" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/actions?query=workflow%3Aci">
<img alt="Build status" src="https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/issues?q=is%3Aissue+is%3Aopen+label%3Amodule%3Acommand">
<img alt="issues" src="https://img.shields.io/github/issues/c4spar/deno-cliffy/module:flags?label=issues&logo=github">
</a>
<a href="https://github.com/c4spar/deno-cliffy/actions?query=workflow%3Aci">
<img alt="Licence" src="https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github" />
</a>
</p>

<p align="center">
<b>Control cli cursor, erase output and scroll window.</b></br>
<sub>>_ Used by cliffy's <a href="../prompt/">prompt</a> module<sub>
</p>

## Usage

Expand Down
38 changes: 28 additions & 10 deletions packages/command/README.md
@@ -1,12 +1,30 @@
# Cliffy - Command

The complete solution for [Deno](https://deno.land/) command-line interfaces, inspired by [node.js's](http://nodejs.org) [commander.js](https://github.com/tj/commander.js/blob/master/Readme.md).

**WARNING:** This module is still under development. Not all features are fully implemented and it is possible you get some breaking changes if you upgrade to a newer version. If you find a bug or have a feature request feel free to create an issue.

![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github) ![GitHub Release Date](https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github)

![Build Status](https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master) ![Deno version](https://img.shields.io/badge/deno-v1.0.0%20rc2-green?logo=deno) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/c4spar/deno-cliffy?logo=github) ![GitHub issues](https://img.shields.io/github/issues/c4spar/deno-cliffy?logo=github) ![GitHub licence](https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github)
<h1 align="center">Cliffy ❯ Command</h1>

<p align="center">
<a href="https://github.com/c4spar/deno-cliffy/releases">
<img alt="Version" src="https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/releases">
<img alt="Release date" src="https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github" />
</a>
<a href="https://deno.land/">
<img alt="Deno version" src="https://img.shields.io/badge/deno-v1.0.0%20rc2-green?logo=deno" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/actions?query=workflow%3Aci">
<img alt="Build status" src="https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/issues?q=is%3Aissue+is%3Aopen+label%3Amodule%3Acommand">
<img alt="issues" src="https://img.shields.io/github/issues/c4spar/deno-cliffy/module:command?label=issues&logo=github">
</a>
<a href="https://github.com/c4spar/deno-cliffy/actions?query=workflow%3Aci">
<img alt="Licence" src="https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github" />
</a>
</p>

<p align="center">
<b> The complete solution for <a href="https://deno.land/">Deno</a> command-line interfaces </b></br>
<sub>>_ Create flexible command line interfaces with type checking, auto generated help and out of the box support for shell completions <sub>
</p>

### ✨ Features

Expand All @@ -25,7 +43,7 @@ The complete solution for [Deno](https://deno.land/) command-line interfaces, in
* ⭐️ auto generated help ⭐️
* ⭐️ out of the box support for shell completion's ⭐️

### Content
### Table of content

- [Creating a program](#creating-a-program)
- [Options](#options)
Expand Down
125 changes: 121 additions & 4 deletions packages/flags/README.md
@@ -1,10 +1,127 @@
# Cliffy - Flags
<h1 align="center">Cliffy Flags </h1>

Command line parser for [Deno](https://deno.land/) and used by cliffy's [command](../command/) module.
<p align="center">
<a href="https://github.com/c4spar/deno-cliffy/releases">
<img alt="Version" src="https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/releases">
<img alt="Release date" src="https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github" />
</a>
<a href="https://deno.land/">
<img alt="Deno version" src="https://img.shields.io/badge/deno-v1.0.0%20rc2-green?logo=deno" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/actions?query=workflow%3Aci">
<img alt="Build status" src="https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/issues?q=is%3Aissue+is%3Aopen+label%3Amodule%3Acommand">
<img alt="issues" src="https://img.shields.io/github/issues/c4spar/deno-cliffy/module:flags?label=issues&logo=github">
</a>
<a href="https://github.com/c4spar/deno-cliffy/actions?query=workflow%3Aci">
<img alt="Licence" src="https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github" />
</a>
</p>

![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github) ![GitHub Release Date](https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github)
<p align="center">
<b> Command line parser for <a href="https://deno.land/">Deno</a></b></br>
<sub>>_ Used by cliffy's <a href="../command/">command</a> module<sub>
</p>

![Build Status](https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master) ![Deno version](https://img.shields.io/badge/deno-v1.0.0%20rc2-green?logo=deno) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/c4spar/deno-cliffy?logo=github) ![GitHub issues](https://img.shields.io/github/issues/c4spar/deno-cliffy?logo=github) ![GitHub licence](https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github)
## Usage

```typescript
import { parseFlags, OptionType } from 'https://deno.land/x/cliffy/flags.ts';

const { flags, literal, unknown } = parseFlags( Deno.args, {
allowEmpty: true,
flags: [ {
name: 'verbose',
aliases: [ 'v' ],
type: OptionType.BOOLEAN,
// allow to define this option multiple times on the command line
collect: true,
// make --verbose incremental: turn value into an number and increase the value for each --verbose option
value: ( val: boolean, previous: number = 0 ) => previous + 1
}, {
name: 'help',
aliases: [ 'h' ],
type: OptionType.BOOLEAN,
// a standalone option cannot be combined with other options
standalone: true
}, {
name: 'file',
aliases: [ 'f' ],
type: OptionType.STRING,
// file cannot be combined with stdin option
depends: [ 'stdin' ]
}, {
name: 'stdin',
aliases: [ 'i' ],
type: OptionType.BOOLEAN,
// stdin cannot be combined with file option
depends: [ 'file' ]
} ]
} );

if ( flags.help ) {
console.log( 'print help...' );
}

```

## Options

### parseFlags Options

| Param | Type | Required | Description |
| ----- | :--: | :--: | ----------- |
| allowEmpty | `boolean` | No | Allow no arguments. Defaults to `false` |
| flags | `IFlagOptions[]` | No | Array of flag options. |
| parse | `function` | No | Custom type parser. |

### Flag Options

| Param | Type | Required | Description |
| ----- | :--: | :--: | ----------- |
| name | `string` | Yes | The name of the option. |
| args | `IFlagArgument[]` | No | An Array of argument options. |
| aliases | `string[]` | No | Array of option alias's. |
| standalone | `boolean ` | No | Cannot be combined with other options. |
| default | `any` | No | Default option value. |
| required | `boolean ` | No | Mark option as required and throw an error if the option is missing. |
| depends | `string[]` | No | Array of option names on which depends on this option. |
| conflicts | `string[]` | No | Array of option names on which conflicts with this option. |
| collect | `boolean` | No | Allow to call this option multiple times and add each value to an array which will be returned as result. |
| value | `( val: any, previous?: any ) => any` | No | Custom value processing. |

### Argument options

| Param | Type | Required | Description |
| ----- | :--: | :--: | ----------- |
| type | `OptionType \| string` | no | Type of the argument. |
| optionalValue | `boolean` | no | Make argument optional. |
| variadic | `boolean` | no | Make arguments variadic. |
| list | `boolean` | no | Split argument by `separator`. |
| separator | `string` | no | List separator. Defaults to `,` |

## Custom type processing

```typescript
import { parseFlags, IFlagOptions, IFlagArgument } from 'https://deno.land/x/cliffy/flags.ts';

parseFlags( Deno.args, {
parse: ( type: string, option: IFlagOptions, arg: IFlagArgument, nextValue: string ) => {
switch ( type ) {
case 'float':
if ( isNaN( nextValue as any ) ) {
throw new Error( `Option --${ option.name } must be of type number but got: ${ nextValue }` );
}
return parseFloat( nextValue );
default:
throw new Error( `Unknown type: ${ type }` );
}
}
} );
```

## License

Expand Down
38 changes: 29 additions & 9 deletions packages/keycode/README.md
@@ -1,12 +1,32 @@
# Cliffy - KeyCode

ANSI key code parser for [Deno](https://deno.land/). Used by cliffy's [prompt](../prompt/) module.

![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github) ![GitHub Release Date](https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github)

![Build Status](https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master) ![Deno version](https://img.shields.io/badge/deno-v1.0.0%20rc2-green?logo=deno) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/c4spar/deno-cliffy?logo=github) ![GitHub issues](https://img.shields.io/github/issues/c4spar/deno-cliffy?logo=github) ![GitHub licence](https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github)

## Example
<h1 align="center">Cliffy ❯ KeyCode </h1>

<p align="center">
<a href="https://github.com/c4spar/deno-cliffy/releases">
<img alt="Version" src="https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/releases">
<img alt="Release date" src="https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github" />
</a>
<a href="https://deno.land/">
<img alt="Deno version" src="https://img.shields.io/badge/deno-v1.0.0%20rc2-green?logo=deno" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/actions?query=workflow%3Aci">
<img alt="Build status" src="https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/issues?q=is%3Aissue+is%3Aopen+label%3Amodule%3Acommand">
<img alt="issues" src="https://img.shields.io/github/issues/c4spar/deno-cliffy/module:keycode?label=issues&logo=github">
</a>
<a href="https://github.com/c4spar/deno-cliffy/actions?query=workflow%3Aci">
<img alt="Licence" src="https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github" />
</a>
</p>

<p align="center">
<b>ANSI key code parser for <a href="https://deno.land/">Deno</a></b></br>
<sub>>_ Used by cliffy's <a href="../prompt/">prompt</a> module.<sub>
</p>

## Usage

```typescript
#!/usr/bin/env -S deno run
Expand Down
11 changes: 7 additions & 4 deletions packages/prompt/README.md
Expand Up @@ -2,19 +2,22 @@

<p align="center">
<a href="https://github.com/c4spar/deno-cliffy/releases">
<img src="https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github" alt="version" />
<img alt="Version" src="https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/releases">
<img src="https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github" alt="release date" />
<img alt="Release date" src="https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github" />
</a>
<a href="https://deno.land/">
<img src="https://img.shields.io/badge/deno-v1.0.0%20rc2-green?logo=deno" alt="deno" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/actions?query=workflow%3Aci">
<img src="https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master" alt="build status" />
<img alt="Build status" src="https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/issues?q=is%3Aissue+is%3Aopen+label%3Amodule%3Acommand">
<img alt="issues" src="https://img.shields.io/github/issues/c4spar/deno-cliffy/module:prompt?label=issues&logo=github">
</a>
<a href="https://github.com/c4spar/deno-cliffy/actions?query=workflow%3Aci">
<img src="https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github" alt="licence" />
<img alt="Licence" src="https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github" />
</a>
</p>

Expand Down
29 changes: 26 additions & 3 deletions packages/table/README.md
@@ -1,8 +1,31 @@
# Cliffy - Table
<h1 align="center">Cliffy Table </h1>

Render data in table structure with correct indentation and support for multi-line rows.
<p align="center">
<a href="https://github.com/c4spar/deno-cliffy/releases">
<img alt="Version" src="https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/releases">
<img alt="Release date" src="https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github" />
</a>
<a href="https://deno.land/">
<img src="https://img.shields.io/badge/deno-v0.42.0-green?logo=deno" alt="deno" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/actions?query=workflow%3Aci">
<img alt="Build status" src="https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master" />
</a>
<a href="https://github.com/c4spar/deno-cliffy/issues?q=is%3Aissue+is%3Aopen+label%3Amodule%3Acommand">
<img alt="issues" src="https://img.shields.io/github/issues/c4spar/deno-cliffy/module:table?label=issues&logo=github">
</a>
<a href="https://github.com/c4spar/deno-cliffy/actions?query=workflow%3Aci">
<img alt="Licence" src="https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github" />
</a>
</p>

<p align="center">
<b> Easy solution to render table's on the command line </b></br>
<sub>>_ Create cli table's with border, padding, nested table's, etc... <sub>
</p>

![Build Status](https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master)

## Usage

Expand Down

0 comments on commit 7e549c9

Please sign in to comment.