Documentation
¶
Index ¶
- func DecodeRPC(decoder *msgpack.Decoder) ([]string, map[string]string, []byte, error)
- func EncodeRPC(encoder *msgpack.Encoder, name []string, cmd Subcommand, ...) error
- func List() [][]string
- func Register(factory CmdFactory, flags CommandFlags, args ...string)
- type CmdFactory
- type CommandFlags
- type Subcommand
- type SubcommandBase
- func (cmd *SubcommandBase) GetCWD() string
- func (cmd *SubcommandBase) GetCommandLine() string
- func (cmd *SubcommandBase) GetFlags() CommandFlags
- func (cmd *SubcommandBase) GetLogInfo() bool
- func (cmd *SubcommandBase) GetLogTraces() string
- func (cmd *SubcommandBase) GetRepositorySecret() []byte
- func (cmd *SubcommandBase) SetCWD(cwd string)
- func (cmd *SubcommandBase) SetCommandLine(cmdline string)
- func (cmd *SubcommandBase) SetLogInfo(v bool)
- func (cmd *SubcommandBase) SetLogTraces(traces string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeRPC ¶
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, name []string, cmd Subcommand, storeConfig map[string]string) 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 Register ¶
func Register(factory CmdFactory, flags CommandFlags, args ...string)
Types ¶
type CmdFactory ¶
type CmdFactory func() Subcommand
type CommandFlags ¶
type CommandFlags uint32
const ( NeedRepositoryKey CommandFlags = 1 << iota BeforeRepositoryWithStorage BeforeRepositoryOpen AgentSupport IgnoreVersion )
type Subcommand ¶
type Subcommand interface {
Parse(ctx *appcontext.AppContext, args []string) error
Execute(ctx *appcontext.AppContext, repo *repository.Repository) (int, error)
GetRepositorySecret() []byte
GetFlags() CommandFlags
GetCWD() string
SetCWD(string)
GetCommandLine() string
SetCommandLine(string)
GetLogInfo() bool
SetLogInfo(bool)
GetLogTraces() string
SetLogTraces(string)
// contains filtered or unexported methods
}
type SubcommandBase ¶
type SubcommandBase struct {
RepositorySecret []byte
Flags CommandFlags
CWD string
CommandLine string
// XXX - rework that post-release
LogInfo bool
LogTraces string
}
func (*SubcommandBase) GetCWD ¶
func (cmd *SubcommandBase) GetCWD() string
func (*SubcommandBase) GetCommandLine ¶
func (cmd *SubcommandBase) GetCommandLine() string
func (*SubcommandBase) GetFlags ¶
func (cmd *SubcommandBase) GetFlags() CommandFlags
func (*SubcommandBase) GetLogInfo ¶
func (cmd *SubcommandBase) GetLogInfo() bool
func (*SubcommandBase) GetLogTraces ¶
func (cmd *SubcommandBase) GetLogTraces() string
func (*SubcommandBase) GetRepositorySecret ¶
func (cmd *SubcommandBase) GetRepositorySecret() []byte
func (*SubcommandBase) SetCWD ¶
func (cmd *SubcommandBase) SetCWD(cwd string)
func (*SubcommandBase) SetCommandLine ¶
func (cmd *SubcommandBase) SetCommandLine(cmdline string)
func (*SubcommandBase) SetLogInfo ¶
func (cmd *SubcommandBase) SetLogInfo(v bool)
func (*SubcommandBase) SetLogTraces ¶
func (cmd *SubcommandBase) SetLogTraces(traces string)
Click to show internal directories.
Click to hide internal directories.