"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hasBashShebang = exports.isBashShebang = exports.getShebang = void 0;
const SHEBANG_REGEXP = /^#!(.*)/;
function getShebang(fileContent) {
    const match = SHEBANG_REGEXP.exec(fileContent);
    if (!match || !match[1]) {
        return null;
    }
    return match[1].trim();
}
exports.getShebang = getShebang;
/**
 * Check if the given shebang is a bash shebang.
 */
function isBashShebang(shebang) {
    return (shebang.startsWith('/bin/bash') ||
        shebang.startsWith('/bin/sh') ||
        shebang.startsWith('/usr/bin/bash') ||
        shebang.startsWith('/usr/bin/env bash') ||
        shebang.startsWith('/usr/bin/env sh'));
}
exports.isBashShebang = isBashShebang;
function hasBashShebang(fileContent) {
    const shebang = getShebang(fileContent);
    return shebang ? isBashShebang(shebang) : false;
}
exports.hasBashShebang = hasBashShebang;
//# sourceMappingURL=shebang.js.map