hypercmd

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InjectInstaller added in v0.2.0

func InjectInstaller(hc *HyperCommand) *cobra.Command

Types

type HyperCommand

type HyperCommand struct {
	// contains filtered or unexported fields
}

HyperCommand is a container of a root (the hypercommand command itself) and all commands under it. It is special from a regular command in that it can explode its commands into symlinked binaries.

func New added in v0.2.0

func New() *HyperCommand

New initializes a new hypercommand to which commands can be added. An "install" subcommand is already automatically added.

func (*HyperCommand) AddCommand

func (h *HyperCommand) AddCommand(c *cobra.Command)

AddCommand adds a new command to the hypercommand.

func (*HyperCommand) Commands

func (h *HyperCommand) Commands() []*cobra.Command

Commands returns all the commands registered in the hypercommand. This may not include all commands if they were added directly to the root.

func (*HyperCommand) ImportCommands

func (h *HyperCommand) ImportCommands(c *cobra.Command)

ImportCommands adds all subcommands of an existing command to the hypercommand.

func (*HyperCommand) Resolve

func (h *HyperCommand) Resolve(name string, withAliases bool) *cobra.Command

Resolve is given a name of a binary and uses it to return the correct command, or the hypercommand otherwise.

func (*HyperCommand) Root added in v0.2.0

func (h *HyperCommand) Root() *cobra.Command

Root returns the root command of the hypercommand. This might be useful if you want to add a command that should not be expanded into symlinks.

Jump to

Keyboard shortcuts

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