An open API service indexing awesome lists of open source software.

https://github.com/mmcquillan/protocli

Easily prototype your CLI with protocli
https://github.com/mmcquillan/protocli

cli go golang prototyping

Last synced: 10 months ago
JSON representation

Easily prototype your CLI with protocli

Awesome Lists containing this project

README

          

# protocli

This is a CLI prototyping tool using the [Matcher Format](https://github.com/mmcquillan/matcher) with response variable substitution.

## Install

On the mac, you can install via brew as:

`brew install mmcquillan/tools/protocli`

Launch by passing in a config file:

`protocli `

## Commands

The only native command inside protocli is `?` which lists all possible command matches.

## Config

The configuration is a YAML based file. Examples can be found [here](examples).

```
---
prompt: "> "
commands:
-
command: "do version"
response: "0.2.0"
-
command: "do plan "
responses:
-
response: "Planning ${file}..."
-
response: "Complete"
delay: 2
-
command: "do apply "
responses:
-
response: "Applying ${file}..."
-
response: "Error: applying ${file}"
color: "red"
delay: 3
-
command: "do plan [...]"
response: "do plan "
-
command: "do apply [...]"
response: "do apply "
-
command: "do [...]"
response: "the do app\n
do version\n
do plan \n
do apply "
```

### prompt
- Description: A prompt to show in the protocli interaction
- Default: `> `
- Type: string

### default
- Description: A default response when no command is matched
- Default: none
- Type: string

### commands
- Description: A list of commands to respond to
- Default: none
- Type: list

### command
- Description: A command to respond to, using the [Matcher Format](https://github.com/mmcquillan/matcher)
- Default: none
- Type: string

### response
- Description: A response to show when the command is written (you can also list responses)
- Default: none
- Type: string

### color
- Description: Color to print the response in (red | green | yellow | blue | magenta | cyan | white)
- Default: white
- Type: string

### delay
- Description: Number of seconds to delay before showing response
- Default: 0
- Type: int

## Releases

v0.2.0
- Added custom prompts
- Added proper exit handling
- Added config command line parameter
- Added output color
- Added dynamic config reload
- Updated matcher library for short flags
- Added delay option to the response
- Added default response for no match

v0.1.0
- Initial Release