Crates.io | sdoc |
lib.rs | sdoc |
version | 0.8.11 |
source | src |
created_at | 2018-01-29 15:25:38.217047 |
updated_at | 2021-10-12 16:38:23.121094 |
description | Framework for building custom CLIs around shell, scripts, and executables |
homepage | https://github.com/matthewwoodruff/sdoc |
repository | https://github.com/matthewwoodruff/sdoc |
max_upload_size | |
id | 48793 |
size | 75,749 |
A framework for building custom CLIs around shell and executables. Commands are defined in yaml and can be sub-commands, shell, or an executable. By convention your root yaml file lives in a directory named the same as your cli name and sub-command configuration in sub directories following the same pattern.
brew tap matthewwoodruff/sdoc https://github.com/matthewwoodruff/sdoc
brew install sdoc
cargo install sdoc
You can download the binary from GitHub Releases and add to your $PATH
Create a new directory for your CLI mkdir <cli-name>
Execute sdoc init
and follow the prompts
Your CLI will be available by executing ./bin/<cli-name>
Modify ./<my-cli>/commands.yaml
to add custom commands and sub-commands
see https://github.com/matthewwoodruff/sdoc/tree/master/tests/data/example-cli for an example cli configuration.
Field | Type | Required | Description |
---|---|---|---|
name | string | yes | Command name |
description | string | yes | Description that will be show in help |
type | type | yes | Type of command. See below for options. |
alias | string | no | A shorter version of the command name |
usage | string | no | Usage text to be shown in help |
dependencies | list<dependency> | no | List of dependencies. See below for options. |
min_args | int | no | Minimum amount of arguments to be supplied |
Option | Value | Description |
---|---|---|
node | - | Sub-command |
shell | string | Shell code to execute |
script | string | A script file relative to the commands file |
Field | Type | Required | Description |
---|---|---|---|
value | dependency-type | yes | Dependency type. See below for options. |
description | string | yes | Shown against dependency in command usage |
Option | Value | Description |
---|---|---|
command | string | An executable in your $PATH that must exist |
envar | string | An environment variable that must be set |