Skip to content

Commit 4f9f95d

Browse files
committed
chore(docs): update some docs
1 parent 7dbca01 commit 4f9f95d

12 files changed

Lines changed: 53 additions & 37 deletions

File tree

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/libreworks/cli?sort=semver)](https://github.com/libreworks/cli/releases)
77
[![codecov](https://codecov.io/gh/libreworks/cli/branch/main/graph/badge.svg?token=OHTRGNTSPO)](https://codecov.io/gh/libreworks/cli)
88

9-
A simple set of utilities for command line interface programs.
9+
This library builds on [Commander.js](https://github.com/tj/commander.js/) and adds logging, prompting, busy indicators, and other I/O goodies.
1010

1111
## Installation
1212

@@ -16,12 +16,25 @@ npm install @libreworks/cli
1616

1717
This library conforms to ECMAScript Modules (ESM). You can import this module using ESM or TypeScript syntax.
1818

19-
```TypeScript
20-
import { Streams } from "@libreworks/cli";
19+
```typescript
20+
import { Output, Program } from "@libreworks/cli";
2121
```
2222

2323
If you're using CommonJS, you must use [dynamic imports](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) instead.
2424

25+
## Usage
26+
27+
```typescript
28+
const output = Output.create({});
29+
const program = new Program(output, "Sample Program")
30+
.description("A test of @libreworks/cli")
31+
.version("0.0.1");
32+
.action(function () {
33+
output.write("You called the handler!");
34+
});
35+
await program.parseAsync();
36+
```
37+
2538
## Documentation
2639

2740
- [Examples](docs/examples)

docs/api/assets/highlight.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
--dark-hl-3: #C586C0;
1010
--light-hl-4: #001080;
1111
--dark-hl-4: #9CDCFE;
12-
--light-hl-5: #008000;
13-
--dark-hl-5: #6A9955;
14-
--light-hl-6: #0000FF;
15-
--dark-hl-6: #569CD6;
16-
--light-hl-7: #0070C1;
17-
--dark-hl-7: #4FC1FF;
12+
--light-hl-5: #0000FF;
13+
--dark-hl-5: #569CD6;
14+
--light-hl-6: #0070C1;
15+
--dark-hl-6: #4FC1FF;
16+
--light-hl-7: #008000;
17+
--dark-hl-7: #6A9955;
1818
--light-hl-8: #267F99;
1919
--dark-hl-8: #4EC9B0;
2020
--light-hl-9: #811F3F;

docs/api/classes/Output.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><p>Whether the operation was successful</p>
3838
<aside class="tsd-sources"><p>Implementation of <a href="../interfaces/OutputHelper.html">OutputHelper</a>.<a href="../interfaces/OutputHelper.html#write">write</a></p></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="create"><code class="tsd-tag">Static</code><span>create</span><a href="#create" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="create-1"><span class="tsd-kind-call-signature">create</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?:</span> <a href="../interfaces/OutputOptions.html" class="tsd-signature-type tsd-kind-interface">OutputOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="" class="tsd-signature-type tsd-kind-class">Output</a><a href="#create-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates a new Output helper.</p>
3939
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/OutputOptions.html" class="tsd-signature-type tsd-kind-interface">OutputOptions</a><span class="tsd-signature-symbol"> = {}</span></span><div class="tsd-comment tsd-typography"><p>Optional, an object containing configuration options</p>
40-
</div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="" class="tsd-signature-type tsd-kind-class">Output</a></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example">Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">import</span><span class="hl-1"> </span><span class="hl-4">cliSpinners</span><span class="hl-1"> </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">&#39;cli-spinners&#39;</span><span class="hl-1">;</span><br/><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-4">Output</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">&quot;@libreworks/cli&quot;</span><span class="hl-1">;</span><br/><br/><span class="hl-5">// Default options</span><br/><span class="hl-4">Output</span><span class="hl-1">.</span><span class="hl-0">create</span><span class="hl-1">({});</span><br/><br/><span class="hl-5">// All options</span><br/><span class="hl-4">Output</span><span class="hl-1">.</span><span class="hl-0">create</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">spinner:</span><span class="hl-1"> </span><span class="hl-4">cliSpinners</span><span class="hl-1">.</span><span class="hl-4">pong</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">color:</span><span class="hl-1"> </span><span class="hl-6">false</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">stdout:</span><span class="hl-1"> </span><span class="hl-4">process</span><span class="hl-1">.</span><span class="hl-4">stdout</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">stderr:</span><span class="hl-1"> </span><span class="hl-4">process</span><span class="hl-1">.</span><span class="hl-4">stderr</span><span class="hl-1">,</span><br/><span class="hl-1">});</span>
40+
</div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="" class="tsd-signature-type tsd-kind-class">Output</a></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example">Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">import</span><span class="hl-1"> </span><span class="hl-4">cliSpinners</span><span class="hl-1"> </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">&#39;cli-spinners&#39;</span><span class="hl-1">;</span><br/><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-4">Output</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">&quot;@libreworks/cli&quot;</span><span class="hl-1">;</span><br/><br/><span class="hl-7">// Default options</span><br/><span class="hl-4">Output</span><span class="hl-1">.</span><span class="hl-0">create</span><span class="hl-1">({});</span><br/><br/><span class="hl-7">// All options</span><br/><span class="hl-4">Output</span><span class="hl-1">.</span><span class="hl-0">create</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">spinner:</span><span class="hl-1"> </span><span class="hl-4">cliSpinners</span><span class="hl-1">.</span><span class="hl-4">pong</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">color:</span><span class="hl-1"> </span><span class="hl-5">false</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">stdout:</span><span class="hl-1"> </span><span class="hl-4">process</span><span class="hl-1">.</span><span class="hl-4">stdout</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">stderr:</span><span class="hl-1"> </span><span class="hl-4">process</span><span class="hl-1">.</span><span class="hl-4">stderr</span><span class="hl-1">,</span><br/><span class="hl-1">});</span>
4141
</code><button type="button">Copy</button></pre>
4242

4343
</div></div></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Accessors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Accessors</summary><div><a href="#colors"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Accessor"><use href="../assets/icons.svg#icon-262144"></use></svg><span>colors</span></a><a href="#log"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Accessor"><use href="../assets/icons.svg#icon-262144"></use></svg><span>log</span></a><a href="#spinner"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Accessor"><use href="../assets/icons.svg#icon-262144"></use></svg><span>spinner</span></a><a href="#stderr"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Accessor"><use href="../assets/icons.svg#icon-262144"></use></svg><span>stderr</span></a><a href="#stdout"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Accessor"><use href="../assets/icons.svg#icon-262144"></use></svg><span>stdout</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#disablecolor"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>disable<wbr/>Color</span></a><a href="#disablespinner"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>disable<wbr/>Spinner</span></a><a href="#displayerror"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>display<wbr/>Error</span></a><a href="#fail"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>fail</span></a><a href="#setloglevel"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Log<wbr/>Level</span></a><a href="#spinduring"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>spin<wbr/>During</span></a><a href="#write"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write</span></a><a href="#create"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@libreworks/cli</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>

0 commit comments

Comments
 (0)