commander

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CmdCompletion *conq.Cmd = &conq.Cmd{
	Name: "completion",
	Run: func(c conq.Ctx) error {
		line, point, ctype, ok := completionContext()

		if ok {
			return doCompletion(c.Com, c.Path[0], line, point, ctype)
		}

		// show some installation instructions and exit
		var pth strings.Builder
		pth.WriteString(c.Path[0].Name)
		for _, x := range c.Path[1:] {
			fmt.Fprintf(&pth, " %s", x.Name)
		}
		pth.WriteString(" completion")

		fmt.Fprintf(c.Out, "complete -C %q %s\n", pth.String(), c.Path[0].Name)
		return nil
	},
}

Functions

This section is empty.

Types

type Commander

type Commander struct {
	O conq.Optioner
	H conq.Helper
	P *message.Printer
}

func New

func New(o conq.Optioner, h conq.Helper) Commander

func (Commander) Execute

func (c Commander) Execute(root *conq.Cmd, ctx conq.Ctx) error

func (Commander) Helper

func (c Commander) Helper() conq.Helper

func (Commander) Optioner

func (c Commander) Optioner() conq.Optioner

func (Commander) ResolveCmd

func (c Commander) ResolveCmd(root *conq.Cmd, ctx conq.Ctx) (oc conq.Ctx)

Path should always include the root command and the leaf-command that's being executed

Jump to

Keyboard shortcuts

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