cmd

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: Apache-2.0 Imports: 19 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 archive with optional compression",
	Flags: &BackupFlags{},
	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 Status = cmd.Sub{
	Name:  "status",
	Alias: "n",
	Short: "View status info about a Minecraft server",
	Flags: &StatusFlags{},
	Run:   ServerStatus,
}

Status prints information about 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 tar archive with optional compression.

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 ServerStatus added in v1.3.0

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

ServerStatus handles the `Status` command and prints out various information about a Minecraft server.

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 BackupFlags added in v1.2.0

type BackupFlags struct {
	Level int `short:"l" long:"level" desc:"Set the compression format to use; 0: no compression; 1: gzip"`
}

BackupFlags holds the flags for the backup command.

type DownloaderArgs added in v1.1.0

type DownloaderArgs struct {
	Args []string `zero:"true" 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.

type StatusFlags added in v1.3.0

type StatusFlags struct {
	ShowAll      bool `short:"a" desc:"Print all extra server info"`
	ShowGameplay bool `short:"g" desc:"Print gameplay properties"`
	ShowRcon     bool `short:"r" desc:"Print Rcon configuration information"`
	ShowWorld    bool `short:"w" desc:"Print main world informations"`
}

StatusFlags holds the various flags that can be passed to the status command.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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