mirror of
https://github.com/XAMPPRocky/tokei
synced 2024-09-13 21:11:29 +00:00
[issue_934] from_shebang tera function uses starts_with (#935)
This allows to cover versioning of language executables, like it can happen for Python. Currently there is python, python2 and python3. Could just add python2.7, but we should add new env item for each new Python version, like python3.4, python3.10, etc which soon may be somewhat cumbersone.
This commit is contained in:
parent
54a6200fac
commit
61dd7df6fc
|
@ -380,7 +380,13 @@ impl LanguageType {
|
|||
match word {
|
||||
{% for key, value in languages -%}
|
||||
{%- if value.env -%}
|
||||
{%- for item in value.env %}| "{{item}}" {% endfor %}=> Some({{key}}),
|
||||
{%- for item in value.env %}
|
||||
{% if loop.index == 1 %}
|
||||
_ if word.starts_with("{{item}}")
|
||||
{% else %}
|
||||
|| word.starts_with("{{item}}")
|
||||
{% endif %}
|
||||
{% endfor %}=> Some({{key}}),
|
||||
{% endif -%}
|
||||
{%- endfor %}
|
||||
env => {
|
||||
|
|
Loading…
Reference in a new issue