Skip to main content

looks_like_bash

Function looks_like_bash 

Source
pub fn looks_like_bash(input: &str) -> bool
Expand description

Quick check: does this string contain bash-specific syntax? This must be FAST — it runs on every Enter keypress. No regex, no parsing — just byte-level pattern scanning.

§Examples

use reef::detect::looks_like_bash;

assert!(looks_like_bash("if [[ $x == 1 ]]; then echo yes; fi"));
assert!(looks_like_bash("export FOO=bar"));
assert!(!looks_like_bash("echo hello"));