pub fn tags_from_interpreter(interpreter: &str) -> TagSetExpand description
Identify tags based on a shebang interpreter.
This function analyzes interpreter names from shebang lines to determine the script type. It handles version-specific interpreters by progressively removing version suffixes.
§Arguments
interpreter- The interpreter name or path from a shebang
§Returns
A set of tags for the interpreter type. Returns an empty set if the interpreter is not recognized.
§Examples
use file_identify::tags_from_interpreter;
let tags = tags_from_interpreter("python3.11");
assert!(tags.contains("python"));
assert!(tags.contains("python3"));
let tags = tags_from_interpreter("/usr/bin/bash");
assert!(tags.contains("shell"));
assert!(tags.contains("bash"));
let tags = tags_from_interpreter("unknown-interpreter");
assert!(tags.is_empty());