Skip to main content

resolve_session

Function resolve_session 

Source
pub fn resolve_session(
    store: &SessionStore,
    identifier: &str,
    interactive: bool,
) -> Result<Session, ResolveError>
Expand description

Resolve a session identifier to a loaded Session.

Resolution order:

  1. Scan all sessions for a name match (collecting names for fuzzy fallback)
  2. If exactly one name match: return it
  3. If no name match: try UUID lookup via store.load(identifier)
  4. If no UUID match either: return ResolveError with fuzzy suggestions
  5. If multiple name matches AND interactive: enhanced dialoguer::Select with date + command count
  6. If multiple name matches AND NOT interactive: pick most recent by started_at (deterministic duplicate resolution)

§Errors

Returns ResolveError containing a RecError and optional fuzzy suggestions.

§Panics

Panics if internal iterator operations produce an empty collection when a non-empty result is expected (should not happen due to match guards).