extcmd

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ListUserCmd = &gcli.Command{
	Name:    "list",
	Desc:    "list all added user commands",
	Aliases: []string{"ls", "l"},
}
View Source
var TaskInfo = &gcli.Command{
	Name: "info",
	Desc: "show an Task information",
}
View Source
var TaskList = &gcli.Command{
	Name:    "list",
	Desc:    "list all Tasks",
	Aliases: []string{"ls", "l"},
}
View Source
var TaskManageCmd = &gcli.Command{
	Name: "task",
	Desc: "Task/Script run and management command",

	Subs: []*gcli.Command{
		TaskList,
		TaskInfo,
		TaskRun,
	},
	Config: func(c *gcli.Command) {

	},
	Func: func(c *gcli.Command, args []string) error {
		return nil
	},
}

TaskManageCmd instance

View Source
var TaskRun = &gcli.Command{
	Name: "run",
	Desc: "run an Task",
}
View Source
var UserExtCmd = &gcli.Command{
	Name:    "xapp",
	Aliases: []string{"xcmd", "uapp", "ucmd"},
	Desc:    "manage and execute user extension cli app commands",
	Subs: []*gcli.Command{
		ListUserCmd,
	},
	Config: func(c *gcli.Command) {
		c.BoolOpt2(&ueOpts.list, "list, ls", "display all user extra commands")
		c.StrOpt2(&ueOpts.info, "info, show, i", "display info for the input command")

		c.AddArg("command", "input command for execute")
	},
	Func: func(c *gcli.Command, args []string) error {

		name := c.Arg("command").String()
		if len(name) == 0 {
			return c.NewErr("please input command name for handle")
		}

		return nil
	},
}

UserExtCmd instance TODO 暂时由 kscript.scriptApp 替代

Functions

func NewKScriptCmd

func NewKScriptCmd() *gcli.Command

NewKScriptCmd create a command instance

Types

type CmdAction

type CmdAction struct {
	Name    string   `json:"name"`
	Desc    string   `json:"desc"`
	User    string   `json:"user"`
	Workdir string   `json:"workdir"`
	Cmds    []string `json:"cmds"`
}

CmdAction struct

type CmdGroup

type CmdGroup struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Author  string `json:"author"`
	// Description message
	Description string `json:"description"`
	// DefaultAction on run
	DefaultAction string `json:"default_action"`
	Context       struct {
		Workdir string `json:"workdir"`
	} `json:"context"`
	Actions map[string]*CmdAction `json:"actions"`
}

CmdGroup struct

type ExtraCmds

type ExtraCmds struct {
	maputil.Aliases
	// MetaDir path for load CmdGroup
	MetaDir string `json:"meta_dir"`
	// contains filtered or unexported fields
}

ExtraCmds config as command

func (*ExtraCmds) Info

func (ec *ExtraCmds) Info(name string)

func (*ExtraCmds) Init

func (ec *ExtraCmds) Init() error

func (*ExtraCmds) List

func (ec *ExtraCmds) List(name string)

func (*ExtraCmds) Run

func (ec *ExtraCmds) Run(args []string)

Jump to

Keyboard shortcuts

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