From da685c65843dcfddc75e273ac4864c1492ed869d Mon Sep 17 00:00:00 2001 From: Malix - Alix Brunet Date: Sun, 6 Sep 2026 21:10:02 +0200 Subject: [PATCH] Add support for 'nu' extension and Nushell interpreters --- identify/extensions.py | 1 + identify/interpreters.py | 2 ++ tests/identify_test.py | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/identify/extensions.py b/identify/extensions.py index f877350..e77073a 100644 --- a/identify/extensions.py +++ b/identify/extensions.py @@ -191,6 +191,7 @@ 'nimble': {'text', 'nimble'}, 'nix': {'text', 'nix'}, 'njk': {'text', 'nunjucks'}, + 'nu': {'text', 'nushell'}, 'otf': {'binary', 'otf'}, 'p12': {'binary', 'p12'}, 'pas': {'text', 'pascal'}, diff --git a/identify/interpreters.py b/identify/interpreters.py index e4d3d6e..4a13a7e 100644 --- a/identify/interpreters.py +++ b/identify/interpreters.py @@ -12,6 +12,8 @@ 'ksh': {'shell', 'ksh'}, 'node': {'javascript'}, 'nodejs': {'javascript'}, + 'nu': {'nushell'}, + 'nushell': {'nushell'}, 'perl': {'perl'}, 'php': {'php'}, 'php7': {'php', 'php7'}, diff --git a/tests/identify_test.py b/tests/identify_test.py index fb372ba..33e7aa7 100644 --- a/tests/identify_test.py +++ b/tests/identify_test.py @@ -40,6 +40,7 @@ def test_all_tags_contains_each_type(): assert 'dockerfile' in identify.ALL_TAGS # by file convention assert 'python3' in identify.ALL_TAGS # by shebang assert 'php8' in identify.ALL_TAGS # by shebang + assert 'nushell' in identify.ALL_TAGS def test_tags_from_path_does_not_exist(tmpdir): @@ -153,6 +154,7 @@ def test_tags_from_path_plist_text(tmpdir): ( ('.salt-lint', {'text', 'salt-lint', 'yaml'}), ('test.py', {'text', 'python'}), + ('test.nu', {'text', 'nushell'}), ('test.mk', {'text', 'makefile'}), ('Makefile', {'text', 'makefile'}), ('Containerfile', {'text', 'dockerfile'}), @@ -211,6 +213,8 @@ def test_tags_from_filename(filename, expected): ('python3', {'python3', 'python'}), ('python3.5.2', {'python3', 'python'}), ('/usr/bin/python3.5.2', {'python3', 'python'}), + ('nu', {'nushell'}), + ('nushell', {'nushell'}), ('/usr/bin/herpderpderpderpderp', set()), ('something-random', set()), ('', set()),