Documentation ¶
Index ¶
- func FileExist(filename string) bool
- func FileMode(filename string) fs.FileMode
- func FileSize(filename string) (bool, int64)
- func GuessUTF8File(filename string) bool
- func HomeFile(filename string) string
- func IgnoreFile(filename string) bool
- func IsDir(filename string) bool
- func IsSymlink(filename string) bool
- func ParseFlag(args ...string)
- func ReadLastLink(name string) string
- func RunOpMapCmd[T any]()
- func Yorn(s string, args ...any)
- type Cmd
- type OP
- type OPMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GuessUTF8File ¶
func IgnoreFile ¶
func ParseFlag ¶
func ParseFlag(args ...string)
ParseFlag specifies non-flag args. Ex. ParseFlag("required_arg0", "[optional_arg1]") Optional args must appear after required args.
func ReadLastLink ¶
func RunOpMapCmd ¶
func RunOpMapCmd[T any]()
RunOpMapCmd is a helper that combines BuildOpMap and RunCmd
Types ¶
type OPMap ¶
type OPMap struct {
// contains filtered or unexported fields
}
func BuildOPMap ¶
BuildOPMap extracts exported methods of opRecv to a map, so that the methods can be called by the name or alias. An example opRecv is,
type GitOP struct {} func (op GitOP) CM_Commit() {...} func (op GitOP) Status() {...}
BuildOPMap[GitOP]() returns an OPMap,
{ "cm": OP{Alias: "cm", Name: "commit", Fn: wrapper_of_GitOP.CM_Commit, "status": OP{Alias: "status", Name: "status", Fn: wrapper_of_GitOP.Status, }
then we can call the op by alias,
var gitop OPMap = BuildOPMap[GitOP]() gitop.Run("cm")
we can add additional methods manually to OPMap,
gitop.Add("log", gitLog)
Click to show internal directories.
Click to hide internal directories.