file

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Index = &ice.Context{Name: "file", Help: "文件命令",
	Caches: map[string]*ice.Cache{},
	Configs: map[string]*ice.Config{
		"file": {Name: "file", Help: "文件命令", Value: kit.Data(kit.MDB_SHORT, "name")},
	},
	Commands: map[string]*ice.Command{
		ice.ICE_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
		ice.ICE_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},

		"dir": {Name: "dir", Help: "dir", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
			if len(arg) > 0 {
				if s, e := os.Stat(arg[0]); e == nil && !s.IsDir() {
					m.Cmdy("cat", arg)
					return
				}
			}

			m.Cmdy(ice.CLI_SYSTEM, "ls", arg)
			m.Set(ice.MSG_APPEND)
		}},
		"cat": {Name: "cat", Help: "cat", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
			if len(arg) == 0 {
				return
			}

			if s, e := os.Stat(arg[0]); e == nil && s.IsDir() {
				m.Cmdy("dir", arg)
				return
			}

			m.Cmdy(ice.CLI_SYSTEM, cmd, arg)
			m.Set(ice.MSG_APPEND)
		}},
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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