sdoc

Crates.iosdoc
lib.rssdoc
version0.8.11
sourcesrc
created_at2018-01-29 15:25:38.217047
updated_at2021-10-12 16:38:23.121094
descriptionFramework for building custom CLIs around shell, scripts, and executables
homepagehttps://github.com/matthewwoodruff/sdoc
repositoryhttps://github.com/matthewwoodruff/sdoc
max_upload_size
id48793
size75,749
Matt Woodruff (matthewwoodruff)

documentation

README

sdoc

Build Status dependency status

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.

Install

Homebrew
brew tap matthewwoodruff/sdoc https://github.com/matthewwoodruff/sdoc
brew install sdoc
Cargo
cargo install sdoc
Manual

You can download the binary from GitHub Releases and add to your $PATH

Create CLI

  • 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

Example

see https://github.com/matthewwoodruff/sdoc/tree/master/tests/data/example-cli for an example cli configuration.

Yaml Configuration

Command
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
Type
Option Value Description
node - Sub-command
shell string Shell code to execute
script string A script file relative to the commands file
Dependencies
Field Type Required Description
value dependency-type yes Dependency type. See below for options.
description string yes Shown against dependency in command usage
Dependency Type
Option Value Description
command string An executable in your $PATH that must exist
envar string An environment variable that must be set
Commit count: 188

cargo fmt