Skip to main content

detect

Function detect 

Source
pub fn detect(data: &[u8], filename: Option<&str>) -> Shell
Expand description

Detect the history format from the bytes and an optional filename hint.

Content sniffing wins over the filename (a renamed file is still parseable): a zsh : <epoch>:<elapsed>; line or a fish - cmd: record is unambiguous; a bash #<epoch> timestamp line marks timestamped bash. Otherwise the filename disambiguates PSReadLine vs plain bash; failing that, Unknown (plain lines).