Skip to content

Generate an interactive, autocompleting shell for any Cobra CLI

License

Notifications You must be signed in to change notification settings

brianstrauch/cobra-shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cobra-shell

logo

Description

Leverages the Cobra completion API to generate an interactive shell for any Cobra CLI, powered by go-prompt.

  • On-the-fly autocompletion for all commands
  • Static and dynamic autocompletion for args and flags, as described here
  • Full prompt customizability

Usage

Download

go get github.com/brianstrauch/cobra-shell

Example

package main

import (
    shell "github.com/brianstrauch/cobra-shell"
    "github.com/spf13/cobra"
)

func main() {
	cmd := &cobra.Command{Use: "example"}
	cmd.AddCommand(shell.New())
	_ = cmd.Execute()
}

About

Generate an interactive, autocompleting shell for any Cobra CLI

Topics

Resources

License

Stars

Watchers

Forks

Languages