subcommands

package
v0.4.27-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: ISC Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeRPC

func DecodeRPC(decoder *msgpack.Decoder) (string, []byte, error)

Decode extracts the request encoded by Encode(). It returns the name of the RPC and the raw bytes of the request. The raw bytes can be used by the caller to unmarshal the bytes with the correct struct.

func EncodeRPC

func EncodeRPC(encoder *msgpack.Encoder, cmd RPC) error

Encode marshals the RPC into the msgpack encoder. It prefixes the RPC with the Name() of the RPC. This is used to identify the RPC on decoding.

func List

func List() []string

func Register

func Register(command string, fn parseArgsFn)

Types

type RPC

type RPC interface {
	Subcommand
	Name() string
}

RPC extends subcommands.Subcommand, but it also includes the Name() method used to identify the RPC on decoding.

type Subcommand

type Subcommand interface {
	Execute(ctx *appcontext.AppContext, repo *repository.Repository) (int, error)
}

func Parse

func Parse(ctx *appcontext.AppContext, repo *repository.Repository, command string, args []string) (Subcommand, error)

Jump to

Keyboard shortcuts

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