Documentation
¶
Index ¶
- Variables
- func HintMissingSpace(args []string, message string)
- 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 MakeKV(k Atom, v Atom) 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"), false} Address = placeholder{i18n.G("address"), false} AddressSet = placeholder{i18n.G("address set"), false} Alias = placeholder{i18n.G("alias"), false} Backend = placeholder{i18n.G("backend"), false} BackupFile = placeholder{i18n.G("backup file"), false} Bucket = placeholder{i18n.G("bucket"), false} Client = placeholder{i18n.G("client"), false} CommandLine = list{placeholder{i18n.G("command-line argument"), true}, 1, " "} Default = placeholder{i18n.G("default"), false} Device = placeholder{i18n.G("device"), false} Direction = alternative{[]Atom{verbatim{"ingress"}, verbatim{"egress"}}} Directory = placeholder{i18n.G("directory"), false} Driver = placeholder{i18n.G("driver"), false} EndOfFlags = hide{optional{verbatim{"--"}}, verbatim{"[flags] [--]"}} Expiry = placeholder{i18n.G("expiry"), false} File = placeholder{i18n.G("file"), false} Filter = placeholder{i18n.G("filter"), false} Fingerprint = placeholder{i18n.G("fingerprint"), false} Group = placeholder{i18n.G("group"), false} Image = placeholder{i18n.G("image"), false} Instance = placeholder{i18n.G("instance"), false} Interface = placeholder{i18n.G("interface"), false} ListenAddress = placeholder{i18n.G("listen address"), false} ListenPort = placeholder{i18n.G("listen port"), false} KeepaliveTimeout = placeholder{i18n.G("keepalive timeout"), false} Key = placeholder{i18n.G("key"), false} KV = MakeKV(Key, Value) Member = placeholder{i18n.G("member"), false} Network = placeholder{i18n.G("network"), false} NetworkIntegration = placeholder{i18n.G("network integration"), false} Operation = placeholder{i18n.G("operation"), false} Path = placeholder{i18n.G("path"), true} Peer = placeholder{i18n.G("peer"), false} Pool = placeholder{i18n.G("pool"), false} Port = placeholder{i18n.G("port"), false} Profile = placeholder{i18n.G("profile"), false} Project = placeholder{i18n.G("project"), false} Protocol = placeholder{i18n.G("protocol"), false} Query = placeholder{i18n.G("query"), false} Record = placeholder{i18n.G("record"), false} Remote = placeholder{i18n.G("remote"), false} RemoteColon = remote{Remote, nil, false} RemoteColonOpt = remote{Remote, nil, true} RemoteImage = compound{":", []Atom{optional{Remote}, Image}} Role = placeholder{i18n.G("role"), false} Snapshot = placeholder{i18n.G("snapshot"), false} StorageVolumeType = hide{alternative{[]Atom{verbatim{"custom"}, verbatim{"image"}, verbatim{"container"}, verbatim{"virtual-machine"}}}, placeholder{i18n.G("type"), false}} SymlinkTargetPath = placeholder{i18n.G("symlink target path"), false} Tarball = placeholder{i18n.G("tarball"), false} Template = placeholder{i18n.G("template"), false} Token = placeholder{i18n.G("token"), false} Type = placeholder{i18n.G("type"), false} URL = placeholder{i18n.G("URL"), false} Value = placeholder{i18n.G("value"), true} Variable = placeholder{i18n.G("variable"), false} Volume = placeholder{i18n.G("volume"), false} WarningUUID = placeholder{i18n.G("warning UUID"), false} Zone = placeholder{i18n.G("zone"), false} )
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 HintMissingSpace ¶ added in v7.0.2
HintMissingSpace prints a warning when the user may have missed a space after a remote.
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 AsSingleton ¶ added in v7.0.2
AsSingleton returns a parsed atom corresponding to how the given parsed atom would have been parsed in a list atom.
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.