Documentation
¶
Index ¶
- Variables
- func MakeRemote(atom Atom, optional bool) remote
- func Placeholder(element string) placeholder
- func Verbatim(element string) verbatim
- type Atom
- func Colon(a Atom) Atom
- func Either(atoms ...Atom) Atom
- func EitherPlaceholder(elements ...string) Atom
- func EitherVerbatim(elements ...string) Atom
- func Flag(name string) Atom
- func MakePath(atoms ...Atom) Atom
- func NewName(p placeholder) Atom
- func Sequence(atoms ...Atom) Atom
- func Target(p placeholder) Atom
- type Config
- type Parsed
- type Usage
Constants ¶
This section is empty.
Variables ¶
var ( ACL = placeholder{i18n.G("ACL")} Address = placeholder{i18n.G("address")} AddressSet = placeholder{i18n.G("address set")} Alias = placeholder{i18n.G("alias")} Backend = placeholder{i18n.G("backend")} BackupFile = placeholder{i18n.G("backup file")} Bucket = placeholder{i18n.G("bucket")} Client = placeholder{i18n.G("client")} CommandLine = list{placeholder{i18n.G("command-line argument")}, 1, " "} Default = placeholder{i18n.G("default")} Device = placeholder{i18n.G("device")} Direction = alternative{[]Atom{verbatim{"ingress"}, verbatim{"egress"}}} Directory = placeholder{i18n.G("directory")} Driver = placeholder{i18n.G("driver")} EndOfFlags = hide{optional{verbatim{"--"}}, verbatim{"[flags] [--]"}} Expiry = placeholder{i18n.G("expiry")} File = placeholder{i18n.G("file")} Filter = placeholder{i18n.G("filter")} Fingerprint = placeholder{i18n.G("fingerprint")} Group = placeholder{i18n.G("group")} Image = placeholder{i18n.G("image")} Instance = placeholder{i18n.G("instance")} Interface = placeholder{i18n.G("interface")} ListenAddress = placeholder{i18n.G("listen address")} ListenPort = placeholder{i18n.G("listen port")} KeepaliveTimeout = placeholder{i18n.G("keepalive timeout")} Key = placeholder{i18n.G("key")} KV = compound{"=", []Atom{Key, Value}} Member = placeholder{i18n.G("member")} Network = placeholder{i18n.G("network")} NetworkIntegration = placeholder{i18n.G("network integration")} Operation = placeholder{i18n.G("operation")} Path = placeholder{i18n.G("path")} Peer = placeholder{i18n.G("peer")} Pool = placeholder{i18n.G("pool")} Port = placeholder{i18n.G("port")} Profile = placeholder{i18n.G("profile")} Project = placeholder{i18n.G("project")} Protocol = placeholder{i18n.G("protocol")} Query = placeholder{i18n.G("query")} Record = placeholder{i18n.G("record")} Remote = placeholder{i18n.G("remote")} RemoteColon = remote{Remote, nil, false} RemoteColonOpt = remote{Remote, nil, true} RemoteImage = compound{":", []Atom{optional{Remote}, Image}} Role = placeholder{i18n.G("role")} Snapshot = placeholder{i18n.G("snapshot")} StorageVolumeType = hide{alternative{[]Atom{verbatim{"custom"}, verbatim{"image"}, verbatim{"container"}, verbatim{"virtual-machine"}}}, placeholder{i18n.G("type")}} SymlinkTargetPath = placeholder{i18n.G("symlink target path")} Tarball = placeholder{i18n.G("tarball")} Template = placeholder{i18n.G("template")} Token = placeholder{i18n.G("token")} Type = placeholder{i18n.G("type")} URL = placeholder{i18n.G("URL")} Value = placeholder{i18n.G("value")} Volume = placeholder{i18n.G("volume")} WarningUUID = placeholder{i18n.G("warning UUID")} Zone = placeholder{i18n.G("zone")} )
A few strings used throughout the Incus client.
var ErrExplainOnly = errors.New(i18n.G("This command was called with --explain; its arguments are valid, but no further processing is done"))
ErrExplainOnly is returned when --explain is used and the CLI invocation is valid.
var LegacyKV = hide{alternative{[]Atom{compound{"=", []Atom{Key, Value}}, deprecated{compound{" ", []Atom{Key, Value}}, i18n.G("please switch to the “<key>=<value>” syntax")}}}, compound{"=", []Atom{Key, Value}}}
LegacyKV is a backward-compatible key/value parsing atom.
Functions ¶
func MakeRemote ¶
MakeRemote transforms an atom into a remote.
func Placeholder ¶
func Placeholder(element string) placeholder
Placeholder builds a placeholder atom from a string.
Types ¶
type Atom ¶
type Atom interface {
List(minOccurrences int, separator ...string) Atom
Optional(chain ...Atom) Atom
Parse(conf Config, servers map[string]incus.InstanceServer, args *[]string) (*Parsed, error)
Render() string
Remote() Atom
}
Atom is the type of command-line atoms.
func EitherPlaceholder ¶
EitherPlaceholder builds an alternative of placeholder atoms from several strings.
func EitherVerbatim ¶
EitherVerbatim builds an alternative of verbatim atoms from several strings.
func NewName ¶
func NewName(p placeholder) Atom
NewName transforms a placeholder (e.g. `<foo>`) into a placeholder suggesting that a new name is requested (e.g. `<new foo name>`).
type Config ¶ added in v7.0.1
type Config struct {
CLIConfig *cliconfig.Config
CLIConfigPath string
Command *cobra.Command
ExplainOnly bool
RTL bool
}
Config is the type of parser configurations.
func (*Config) SaveCLIConfig ¶ added in v7.0.1
SaveCLIConfig saves the client configuration.
type Parsed ¶
type Parsed struct {
// The remote name, if the parsed atom describes a remote.
RemoteName string
// The remote instance server, if the parsed atom describes a remote.
RemoteServer incus.InstanceServer
// The remote object parsed sub-atom, if the parsed atom describes a remote.
RemoteObject *Parsed
// The string argument(s) mapped to this parsed atom.
String string
// The parsed sub-atoms.
List []*Parsed
// The parsed sub-atoms as strings.
StringList []string
// Whether the atom parsing has been skipped.
Skipped bool
// The branch number of an alternative.
BranchID int
// contains filtered or unexported fields
}
Parsed is the type of parsed atoms.
func ParseDefault ¶
ParseDefault returns a parsed atom corresponding to how the given atom is parsed without any argument.
func ParseString ¶
ParseString returns a parsed atom corresponding to a single string.