Skip to main content

session_name_from_path

Function session_name_from_path 

Source
pub fn session_name_from_path(path: &Path) -> String
Expand description

Generate a session name from a file path.

Rules:

  • Uses the filename (not the full path)
  • Strips leading dot (hidden files like .bash_historybash_history)
  • Replaces non-alphanumeric characters (except - and _) with -
  • Collapses consecutive hyphens
  • Trims leading/trailing hyphens
  • Lowercases the result
  • Falls back to imported-session if result is empty or invalid