pub struct AgentDescription {
pub commands: Vec<DescribedCommand>,
pub flags: Vec<DescribedFlag>,
pub secrets: Vec<DescribedSecret>,
pub conflicts: Vec<String>,
}Expand description
What a built agent’s plugins add to the command line, as the agent
writes it when the launcher sets env::DESCRIBE: their commands,
their options and the secrets they ask for, and the plugins whose
agent-loop systems clash, for rig plugin check --build. The launcher
keeps one per build (Home::described) and reads the command line
against it.
The text form is a header line, then one line each, its fields separated by
tabs (shown here as ⇥):
rig-describe 1
command ⇥ stats ⇥ - ⇥ headless ⇥ sessionless ⇥ Count the saved sessions
flag ⇥ remote ⇥ HOST:PATH ⇥ Work in a directory on another machine over SSH
secret ⇥ crypt ⇥ Passphrase for this machine's sessions
conflict ⇥ `a::APlugin` and `b::BPlugin`: a::count and b::reset, on b::TallyFields§
§commands: Vec<DescribedCommand>The plugins’ commands.
flags: Vec<DescribedFlag>The plugins’ options, the fronts’ included.
secrets: Vec<DescribedSecret>The secrets the plugins ask for.
conflicts: Vec<String>Each pair of systems of one agent-loop stage that use the same data with no order between them, one writing it, naming their plugins.
Implementations§
Source§impl AgentDescription
impl AgentDescription
Sourcepub fn parse(text: &str) -> Self
pub fn parse(text: &str) -> Self
Reads a report. Without the header it is empty: a build from before commands, which has none.
Sourcepub fn write(&self) -> String
pub fn write(&self) -> String
The report as text, which Self::parse reads back. Tabs and line
breaks in a field become spaces.
Sourcepub fn command(&self, name: &str) -> Option<&DescribedCommand>
pub fn command(&self, name: &str) -> Option<&DescribedCommand>
The command name, if a plugin adds it.
Sourcepub fn invocation<S: AsRef<str>>(
&self,
args: &[S],
) -> Result<Invocation, String>
pub fn invocation<S: AsRef<str>>( &self, args: &[S], ) -> Result<Invocation, String>
Reads the user’s command line, without the launcher’s own first
word, against this agent, into the canonical Invocation. -p,
-m and -r (Self::resume) are the launcher’s; a plugin option
takes a value as --name=VALUE, or as the next word when it takes
one (--name VALUE); without -p, the first other word is a
command, and every later word is its argument. An option or command
no plugin adds, and a launcher’s word as a command, are refused.
Sourcepub fn resume<S: AsRef<str>>(&self, args: &[S]) -> Option<String>
pub fn resume<S: AsRef<str>>(&self, args: &[S]) -> Option<String>
The session -r <id|name> (or --resume) names on the command
line args, read as Self::invocation reads it: wherever an
option goes, so not after -- or among a command’s words. This
build’s options that take a value take the next word as theirs; an
option it does not know takes none. None without -r, or when
the command line cannot be read.
Sourcepub fn usage(&self) -> String
pub fn usage(&self) -> String
What rig help lists of the build: the plugins’ commands, their
options, and the secrets they ask for, each with the variable that
gives it (never its value).
Sourcepub fn command_names(&self) -> Vec<&str>
pub fn command_names(&self) -> Vec<&str>
The launcher’s commands, then the plugins’.