https://github.com/brianstrauch/cobra-shell
Generate an interactive, autocompleting shell for any Cobra CLI
https://github.com/brianstrauch/cobra-shell
cli cobra go-prompt
Last synced: 6 months ago
JSON representation
Generate an interactive, autocompleting shell for any Cobra CLI
- Host: GitHub
- URL: https://github.com/brianstrauch/cobra-shell
- Owner: brianstrauch
- License: apache-2.0
- Created: 2021-12-01T00:54:15.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-29T10:34:05.000Z (about 1 year ago)
- Last Synced: 2024-10-11T11:17:15.463Z (8 months ago)
- Topics: cli, cobra, go-prompt
- Language: Go
- Homepage:
- Size: 59.6 KB
- Stars: 42
- Watchers: 3
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cobra-shell

## Description
Leverages the Cobra completion API to generate an interactive shell for any [Cobra](https://github.com/spf13/cobra) CLI, powered by [go-prompt](https://github.com/c-bata/go-prompt).
* On-the-fly autocompletion for all commands
* Static and dynamic autocompletion for args and flags, as described [here](https://github.com/spf13/cobra/blob/master/shell_completions.md)
* Full prompt customizability## Usage
## Download
```
go get github.com/brianstrauch/cobra-shell
```## Example
```
package mainimport (
shell "github.com/brianstrauch/cobra-shell"
"github.com/spf13/cobra"
)func main() {
cmd := &cobra.Command{Use: "example"}
cmd.AddCommand(shell.New())
_ = cmd.Execute()
}
```