1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- package Commands
- import (
- "git.swzry.com/NSMCServerLauncher/Terminal"
- "golang.org/x/crypto/ssh/terminal"
- "git.swzry.com/NSMCServerLauncher/Utils"
- )
- func RegistExtendCommands() {
- Terminal.RegistCommand("pwd",Terminal.RegistedCommand{
- CmdFunc: CMD_pwd_C,
- HelpFunc: func(topic string, term *terminal.Terminal) {},
- Intro:"Show current work path",
- Usage:"pwd",
- })
- Terminal.RegistCommand("cd",Terminal.RegistedCommand{
- CmdFunc: CMD_cd_C,
- HelpFunc: func(topic string, term *terminal.Terminal) {},
- Intro:"Change current work path",
- Usage:"cd <path>",
- })
- Terminal.RegistCommand("mcstat",Terminal.RegistedCommand{
- CmdFunc: CMD_mcstat_C,
- HelpFunc: func(topic string, term *terminal.Terminal) {
- //term.Write([]byte("Disconnect to the server.\n"))
- },
- Intro:"Show the Minecraft server running status.",
- Usage:"mcstat",
- })
- Terminal.RegistCommand("sz",Terminal.RegistedCommand{
- CmdFunc: CMD_sz_C,
- HelpFunc: func(topic string, term *terminal.Terminal) {
- term.Write([]byte("This command can help you download file from server using ZMODEM\n\n"))
- term.Write([]byte("ZMODEM is a file transfer protocol that can be carried on SSH/Telnet or other protocol.\n"))
- term.Write([]byte("(See also: https://en.wikipedia.org/wiki/ZMODEM)\n\n"))
- },
- Intro:"Download file from server using ZMODEM",
- Usage:"sz <conf|log|mc> <path_to_file>",
- })
- }
- func RegistInnerCommands() {
- Terminal.RegistCommand("help",Terminal.RegistedCommand{
- CmdFunc: func(args []string, term *terminal.Terminal,context *Utils.UserContextType) {},
- HelpFunc: func(topic string, term *terminal.Terminal) {
- //term.Write([]byte("Disconnect to the server.\n"))
- },
- Intro:"Show help informations.",
- Usage:"help\nhelp <command> [topic]",
- })
- Terminal.RegistCommand("about",Terminal.RegistedCommand{
- CmdFunc: func(args []string, term *terminal.Terminal,context *Utils.UserContextType) {},
- HelpFunc: func(topic string, term *terminal.Terminal) {
- //term.Write([]byte("About this system.\n"))
- },
- Intro:"About this system.",
- Usage:"about",
- })
- Terminal.RegistCommand("exit",Terminal.RegistedCommand{
- CmdFunc: func(args []string, term *terminal.Terminal,context *Utils.UserContextType) {},
- HelpFunc: func(topic string, term *terminal.Terminal) {
- //term.Write([]byte("Disconnect to the server.\n"))
- },
- Intro:"Disconnect to the server.",
- Usage:"exit",
- })
- }
- func RegistAllCommands() {
- Terminal.CommandSystemInit()
- RegistInnerCommands()
- RegistExtendCommands()
- Terminal.GenerateHelpCommandList()
- }
|