shuck-linter 0.0.26

Lint rule engine and checker for shell scripts
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use super::*;

pub(crate) fn word_starts_with_literal_dash(word: &Word, source: &str) -> bool {
    matches!(
        word.parts_with_spans().next(),
        Some((WordPart::Literal(text), span)) if text.as_str(source, span).starts_with('-')
    )
}

pub(super) fn word_starts_with_static_or_literal_dash(word: &Word, source: &str) -> bool {
    static_word_text(word, source).is_some_and(|text| text.starts_with('-'))
        || word_starts_with_literal_dash(word, source)
}