Documentation
¶
Overview ¶
clean_cmd provides command-line utilities for cleaning operations. This module includes various functions to assist with system commands.
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(), }, }
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 ¶
Types ¶
type Config ¶
type Config struct {
ScanDir string `json:"scan_dir" yaml:"scan_dir"`
Pattern string `json:"pattern" yaml:"pattern"`
ExcludeDirs []string `json:"exclude_dirs" yaml:"exclude_dirs"`
MaxDepth int `json:"max_depth" yaml:"max_depth"`
Concurrency int `json:"concurrency" yaml:"concurrency"`
FileExts []string `json:"file_exts" yaml:"file_exts"`
DryRun bool `json:"dry_run" yaml:"dry_run"`
RegexPattern *regexp.Regexp `json:"-" yaml:"-"`
OnMatch func(string) error `json:"-" yaml:"-"`
}
Config 配置结构体
type SysCleaner ¶
type SysCleaner struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.