pub fn detect_format(path: &str, content: &str) -> Result<ImportFormat>Expand description
Detect the import format from file extension and content.
Detection order:
.castextension → error (asciinema not supported).shor.bashextension →BashScript- Shebang lines (
#!/bin/bash,#!/bin/sh,#!/usr/bin/env bash) →BashScript - Lines matching
: TIMESTAMP:DURATION;CMD→ZshHistory - Lines starting with
- cmd:→FishHistory - Default fallback →
BashHistory
§Errors
Returns an error if the file is an unsupported format (e.g., .cast files).
§Panics
Panics if the internal regex pattern is invalid (should never happen).