plugincmdtree

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package plugincmdtree provides functionality for constructing and maintaining the plugin command trees

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPluginsCommandTreeCachePath

func GetPluginsCommandTreeCachePath() string

Types

type Cache

type Cache interface {
	// GetTree returns the plugin command tree
	// If the plugin command tree doesn't exist, it constructs and adds the command tree to the cache
	// and then returns the plugin command tree, otherwise it returns error
	GetTree(plugin *cli.PluginInfo) (*CommandNode, error)
	// ConstructAndAddTree constructs and adds the plugin command tree to the cache
	// If the plugin command tree already exists, it returns success immediately
	ConstructAndAddTree(plugin *cli.PluginInfo) error
	// DeleteTree deletes the plugin command tree from the cache
	DeleteTree(plugin *cli.PluginInfo) error
}

Cache is the local cache for storing and accessing command trees of different plugins

func NewCache

func NewCache() (Cache, error)

NewCache create a cache for plugin command tree

type CommandNode

type CommandNode struct {
	Subcommands    map[string]*CommandNode `yaml:"subcommands" json:"subcommands"`
	Aliases        map[string]struct{}     `yaml:"aliases" json:"aliases"`
	AliasProcessed bool                    `yaml:"-" json:"-"`
}

func NewCommandNode

func NewCommandNode() *CommandNode

Jump to

Keyboard shortcuts

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