huginn CLI whoami prints the persona door state
One bounded line: absent, stored updatedAt=<stamp>, or unreadable; no value of the document. Test over canned Whoami answers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6f483bbe02
commit
27e8d58757
3 changed files with 1059 additions and 1033 deletions
|
|
@ -195,6 +195,7 @@ fn whoami(settings: &Settings) -> Result<u8, Trouble> {
|
|||
render::index_state(&status.index),
|
||||
status.schema_epoch
|
||||
));
|
||||
say(format_args!("persona {}", render::persona_state(&status.persona)));
|
||||
Ok(0)
|
||||
}
|
||||
Ok(other) => {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use std::fmt::Write;
|
||||
|
||||
use huginn_mind::{IndexStatus, PipelineDocumentSummary, PipelineDocumentView, PipelineStatus, PipelineStatusSummary};
|
||||
use huginn_mind::{IndexStatus, PersonaStatus, PipelineDocumentSummary, PipelineDocumentView, PipelineStatus, PipelineStatusSummary};
|
||||
use serde::Serialize;
|
||||
use serde_json::Value;
|
||||
|
||||
|
|
@ -19,6 +19,16 @@ pub fn name_of<T: Serialize>(value: &T) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
/// The persona door's state as one line: no value of the document, only the
|
||||
/// vocabulary the door answers in.
|
||||
pub fn persona_state(persona: &PersonaStatus) -> String {
|
||||
match persona {
|
||||
PersonaStatus::Absent => "absent".into(),
|
||||
PersonaStatus::Stored { updated_at } => format!("stored updatedAt={updated_at}"),
|
||||
PersonaStatus::Unreadable => "unreadable".into(),
|
||||
}
|
||||
}
|
||||
|
||||
/// An index status as one token and its numbers: `Behind pending=3`.
|
||||
pub fn index_state(index: &IndexStatus) -> String {
|
||||
let mut text = name_of(index);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue