syscmd

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: 27 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 SearchExeCmd = &gcli.Command{
	Name:    "find-bin",
	Aliases: []string{"find-exe", "search"},
	Desc:    "search executable file in system PATH",
	Config: func(c *gcli.Command) {
		c.AddArg("keyword", "keywords for search in PATH dirs", true)
	},
	Func: func(c *gcli.Command, _ []string) error {
		files := sysutil.SearchPath(c.Arg("keyword").String(), 10)

		show.AList("Matched exe files:", files)
		return nil
	},
}

SearchExeCmd command

View Source
var SysCmd = &gcli.Command{
	Name:    "sys",
	Aliases: []string{"os", "system"},
	Desc:    "provide some useful system commands",
	Subs: []*gcli.Command{
		SearchExeCmd,
		WhichExeCmd,
		SysInfoCmd,
		common.NewQuickOpenCmd(),
		NewBatchRunCmd(),
		NewEnvInfoCmd(),
		NewClipboardCmd(),
		NewSysCleanCmd(),
	},
}

SysCmd command

View Source
var SysInfoCmd = &gcli.Command{
	Name: "info",

	Desc: "display current operation system information",
	Config: func(c *gcli.Command) {

	},
	Func: func(c *gcli.Command, _ []string) error {
		info := map[string]any{
			"os platform": runtime.GOOS,
			"os arch":     runtime.GOARCH,
		}

		if sysutil.IsWindows() {
			if sysutil.IsMSys() {
				info["hosts file1"] = "/etc/hosts"
				info["hosts file"] = "/c/Windows/System32/drivers/etc/hosts"
			} else {
				info["hosts file"] = "C:\\Windows\\System32\\drivers\\etc\\hosts"
			}
		} else {
			info["hosts file"] = "/etc/hosts"
		}

		show.AList("System info:", info)
		return nil
	},
}

SysInfoCmd command

View Source
var WhichExeCmd = &gcli.Command{
	Name:    "which",
	Aliases: []string{"whereis", "type"},
	Desc:    "show full path for the executable name",
	Config: func(c *gcli.Command) {
		c.AddArg("name", "executable name for match", true)
	},
	Func: func(c *gcli.Command, _ []string) error {
		name := c.Arg("name").String()
		file, err := sysutil.Executable(name)
		if err != nil {
			return err
		}

		fmt.Println(file)
		return nil
	},
}

WhichExeCmd command

Functions

func NewBatchRunCmd

func NewBatchRunCmd() *gcli.Command

NewBatchRunCmd instance

func NewClipboardCmd

func NewClipboardCmd() *gcli.Command

NewClipboardCmd command

func NewEnvInfoCmd

func NewEnvInfoCmd() *gcli.Command

NewEnvInfoCmd instance

func NewSysCleanCmd

func NewSysCleanCmd() *gcli.Command

NewSysCleanCmd 创建系统清理命令

Types

This section is empty.

Jump to

Keyboard shortcuts

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