cobrashell

package module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 10 Imported by: 3

README

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()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(root *cobra.Command, refresh func() *cobra.Command, opts ...prompt.Option) *cobra.Command

New creates a Cobra CLI command named "shell" which runs an interactive shell prompt for the root command.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL