# muxrpc-usage

> nice helpful usage messages for muxrpc

Latest version **2.1.0** (published 2019-05-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install muxrpc-usage
pnpm add muxrpc-usage
yarn add muxrpc-usage
bun add muxrpc-usage
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2019-05-11 |
| First published | 2019-03-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Dominic Tarr |
| Maintainers | dominictarr |

## Links

- npm: https://www.npmjs.com/package/muxrpc-usage
- Repository: ssb://%2BsSXbrBHKAsUGxjUpB+rGkrpEoDLiUBI+FWvv9gBh4=.sha256
- Homepage: https://github.com/dominictarr/muxrpc-usage
- npm.io page: https://npm.io/package/muxrpc-usage

## Dependencies (1)

- [right-pad](https://npm.io/package/right-pad.md) ^1.0.1

## Recent versions

- 2.1.0 (latest) — 2019-05-11
- 2.0.3 — 2019-03-31
- 2.0.2 — 2019-03-31
- 2.0.1 — 2019-03-31
- 1.0.1 — 2019-03-31
- 1.0.0 — 2019-03-31

## README

# muxrpc-usage

nice helpful usage messages for muxrpc

## data structure

muxrpc commands need to return a data structure describing their commands and options.
`muxrpc-usage` can then render it into helpful commands.

``` js
{
  description: description_of_app,
  commands: {
    <Group>: {
      description: description_of_group,
      single: <name>?, //optional, name of option used if called a single positional arg, without --
      commands: {
        <name>: <subgroup|command>,...
      }
    },
    <Command>: {
      type: 'source' | 'sink' | 'async' | 'sync', //muxrpc call type
      description: <text> //description of command
      args: {
        <arg>: {
          type: name_of_type,
          optional: boolean,
          default: string, //default value 
          decription: <text>
        },...
      },
    }
  }
}
```

It is a tree of `Group`, `Command` and `Option` types. The top level is assumed to be a `Group`.
a `Group` has a `description` (just a string) and a map of `Commands` and sub-`Group`s.
A `Command` has a type (which is always a [`muxrpc`](https://github.com/ssbc/muxrpc) call type),
a `description` and `args`. `Args` is a map of `Option`s. `Option`s have a type
(which is just a string naming that type) a `optional` boolean (defaults to true,
set to false if this option is mandatory) and a description.

## formats

there are various ways to display help text

### quick

list the commands available at a level, to be used as a quick reminder when a user
mistypes a command for example.

```
> sbot foo #there is no foo command
createLogStream|get|publish|...
```

### deep

show everything about a command or group

```
> sbot gossip --help
gossip.add # add peer to table
  --id      [FeedId]?             # An ssb feed identity
  --address [MultiServerAddress]? # a multiserver address of an ssb peer

gossip.rm # remove peer from table
  --id      [FeedId]?             # An ssb feed identity
  --address [MultiServerAddress]? # a multiserver address of an ssb peer

gossip.connect # connect to a peer
  --id      [FeedId]?             # An ssb feed identity
  --address [MultiServerAddress]? # a multiserver address of an ssb peer

gossip.disconnect # disconnect from a peer
  --id      [FeedId]?             # An ssb feed identity
  --address [MultiServerAddress]? # a multiserver address of an ssb peer

gossip.changes # stream of changes to peers table

gossip.reconnect # reconnect to all peers

gossip.disable # disable gossip

gossip.enable # enable gossip

```

---
_Source: https://npm.io/package/muxrpc-usage · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
