fix: update resume guidance

This commit is contained in:
Keisuke Hirata 2026-06-21 01:53:32 +09:00
parent 861c351a96
commit d25ca6ff3c
No known key found for this signature in database
2 changed files with 24 additions and 4 deletions

View File

@ -90,7 +90,7 @@ impl std::fmt::Display for DashboardError {
Self::Store(e) => write!(f, "session store error: {e}"), Self::Store(e) => write!(f, "session store error: {e}"),
Self::NoPods => write!( Self::NoPods => write!(
f, f,
"no Tickets or Pods found — create a Ticket with `yoi ticket create` or restore a Pod with `yoi -r`" "no Tickets or Pods found — create a Ticket with `yoi ticket create` or restore a Pod with `yoi resume`"
), ),
} }
} }

View File

@ -32,7 +32,7 @@ const VIEWPORT_LINES: u16 = MAX_ROWS as u16 + 4;
pub enum PickerError { pub enum PickerError {
Io(io::Error), Io(io::Error),
Store(session_store::StoreError), Store(session_store::StoreError),
NoPods, NoPods { all: bool },
} }
impl std::fmt::Display for PickerError { impl std::fmt::Display for PickerError {
@ -40,10 +40,14 @@ impl std::fmt::Display for PickerError {
match self { match self {
Self::Io(e) => write!(f, "io error: {e}"), Self::Io(e) => write!(f, "io error: {e}"),
Self::Store(e) => write!(f, "session store error: {e}"), Self::Store(e) => write!(f, "session store error: {e}"),
Self::NoPods => write!( Self::NoPods { all: true } => write!(
f, f,
"no pods found — start a fresh pod with `yoi` and try again" "no pods found — start a fresh pod with `yoi` and try again"
), ),
Self::NoPods { all: false } => write!(
f,
"no pods found in this workspace — use `yoi resume --all` to list all host/data-dir Pods"
),
} }
} }
} }
@ -159,7 +163,9 @@ pub async fn run(options: PickerOptions) -> Result<PickerOutcome, PickerError> {
.unwrap_or_default(); .unwrap_or_default();
let mut list = list_for_options(&options, stored_pods, live_pods); let mut list = list_for_options(&options, stored_pods, live_pods);
if list.entries.is_empty() { if list.entries.is_empty() {
return Err(PickerError::NoPods); return Err(PickerError::NoPods {
all: matches!(options.scope, PickerScope::All),
});
} }
let mut terminal = make_inline_terminal()?; let mut terminal = make_inline_terminal()?;
@ -404,6 +410,20 @@ mod tests {
assert_eq!(picker_title(), "resume pod pick a pod"); assert_eq!(picker_title(), "resume pod pick a pod");
} }
#[test]
fn picker_no_pods_message_mentions_all_for_workspace_scope() {
let message = PickerError::NoPods { all: false }.to_string();
assert!(message.contains("no pods found in this workspace"));
assert!(message.contains("yoi resume --all"));
}
#[test]
fn picker_no_pods_message_keeps_fresh_pod_hint_for_all_scope() {
let message = PickerError::NoPods { all: true }.to_string();
assert!(message.contains("start a fresh pod with `yoi`"));
assert!(!message.contains("yoi resume --all"));
}
#[test] #[test]
fn picker_workspace_options_filter_by_workspace_metadata() { fn picker_workspace_options_filter_by_workspace_metadata() {
let list = list_for_options( let list = list_for_options(