cmd

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Attach = cmd.Sub{
	Name:  "attach",
	Alias: "a",
	Short: "Open the server console",
	Run:   AttachToSession,
}

Attach opens the server console.

View Source
var Backup = cmd.Sub{
	Name:  "backup",
	Alias: "b",
	Short: "Backup all server files into a .tar.gz archive",
	Run:   ArchiveServer,
}

Backup archives the Minecraft server files.

View Source
var Exec = cmd.Sub{
	Name:  "exec",
	Alias: "e",
	Short: "Executes a command in the Minecraft server",
	Args:  &ExecArgs{},
	Run:   Execute,
}

Exec sends a command to the Minecraft server

View Source
var Init = cmd.Sub{
	Name:  "init",
	Alias: "i",
	Short: "Initialize the setup for a Minecraft server",
	Args:  &DownloaderArgs{},
	Run:   InitServer,
}

Init sets up everything required to start a Minecraft server

Log is our logger via WaterLog. TODO: Make this not suck

View Source
var Start = cmd.Sub{
	Name:  "start",
	Alias: "s",
	Short: "Start the Minecraft server",
	Run:   StartServer,
}

Start attempts to start a Minecraft server.

View Source
var Stop = cmd.Sub{
	Name:  "stop",
	Alias: "t",
	Short: "Stop the Minecraft server",
	Run:   StopServer,
}

Stop attempts to stop a Minecraft server.

View Source
var Update = cmd.Sub{
	Name:  "update",
	Alias: "u",
	Short: "Update the jar file for the Minecraft server",
	Args:  &DownloaderArgs{},
	Run:   UpdateServer,
}

Update downloads a server jar from the given URL.

Functions

func ArchiveServer

func ArchiveServer(root *cmd.Root, c *cmd.Sub)

ArchiveServer adds all directories and files of the server into a Gzip'd tar archive.

func AttachToSession

func AttachToSession(root *cmd.Root, c *cmd.Sub)

AttachToSession attaches to the server console if the server is running.

func Execute

func Execute(root *cmd.Root, c *cmd.Sub)

Execute will run a command on a running Minecraft server

func InitServer

func InitServer(root *cmd.Root, c *cmd.Sub)

InitServer sets up the Minecraft server directory

func PrintDownloaderUsage added in v1.1.0

func PrintDownloaderUsage(sub *cmd.Sub)

PrintDownloaderUsage prints the proper usage to the user.

func StartServer

func StartServer(root *cmd.Root, c *cmd.Sub)

StartServer starts a Minecraft server.

func StopServer

func StopServer(root *cmd.Root, c *cmd.Sub)

StopServer stops the Minecraft server

func UpdateServer

func UpdateServer(root *cmd.Root, c *cmd.Sub)

UpdateServer downloads the specified server file.

Types

type DownloaderArgs added in v1.1.0

type DownloaderArgs struct {
	Args []string `desc:"URL to the server jar to download, or a provider and version, e.g. \"paper 1.16.4\""`
}

DownloaderArgs contains the command arguments for commands that download a server jar file.

func (DownloaderArgs) IsValid added in v1.1.0

func (a DownloaderArgs) IsValid() bool

IsValid checks if the correct number of args were passed. For downloading, args must contain either just one arg with a URL, or two args with the provider name and version.

type ExecArgs

type ExecArgs struct {
	Command string `desc:"The full command to send to the server. Use quotes for multiple words."`
}

ExecArgs contains the command arguments for the execute command

type GlobalFlags

type GlobalFlags struct {
	Path string `short:"p" long:"path" arg:"true" desc:"Set the path of the Minecraft server"`
}

GlobalFlags holds the flags for the root command.

func (GlobalFlags) GetPathPrefix added in v1.1.0

func (f GlobalFlags) GetPathPrefix() (string, error)

GetPathPrefix gets the server path from the command line flags. If there isn't one, return the current working directory.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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