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
- Host: GitHub
- URL: https://github.com/mmcquillan/protocli
- Owner: mmcquillan
- License: mit
- Created: 2019-05-25T01:15:16.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-02-20T18:58:12.000Z (over 6 years ago)
- Last Synced: 2024-11-16T12:16:29.966Z (over 1 year ago)
- Topics: cli, go, golang, prototyping
- Language: Go
- Homepage:
- Size: 18.6 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
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