module

Hansa::Shebang

Content-based shebang detection, ported from go-enry v2's GetLanguagesByShebang strategy. When the interpreter maps to a single language the shebang is considered decisive; when it maps to several (perl -> Perl/Pod, lua -> Lua/Terra) they are handed to the classifier as candidates.

Constants

ENV_OPT_ARGS = /-[i0uCSv]*|--\S+/
ENV_VAR_ARGS = /\S+=\S+/
PYTHON_VERSION = /python\d\.\d+/
SHEBANG_EXEC_HACK = /exec (\w+).+\$0.+\$@/

Class methods

interpreter(content : String) : String

Returns the interpreter named by the shebang line, handling /usr/bin/env indirection and the special cases documented in go-enry's getInterpreter.

Source
languages(content : String) : Array(String)
Source