diff options
author | David Peter <mail@david-peter.de> | 2021-02-16 21:39:38 +0100 |
---|---|---|
committer | David Peter <sharkdp@users.noreply.github.com> | 2021-02-16 22:15:31 +0100 |
commit | 94496df3b01dc874071b7e23fe52bd0aec332b74 (patch) | |
tree | 629956fed65ae77ac41d49930756e1c9b704f504 | |
parent | 0e5ea9c354509ecc408cf0f40bf9d5ef6b62f9f0 (diff) |
Fix broken resolv.conf highlighting
closes #1510
The change in `create_highlighted_versions.py` fixes a "unknown theme
"'1337'" warning. The single quotes were wrong. `bat` was always falling
back to the default theme, so let's use that for now.
-rw-r--r-- | src/syntax_mapping.rs | 5 | ||||
-rwxr-xr-x | tests/syntax-tests/create_highlighted_versions.py | 6 | ||||
-rw-r--r-- | tests/syntax-tests/highlighted/resolv.conf/resolv.conf | 4 | ||||
-rw-r--r-- | tests/syntax-tests/source/resolv.conf/resolv.conf | 4 |
4 files changed, 17 insertions, 2 deletions
diff --git a/src/syntax_mapping.rs b/src/syntax_mapping.rs index da6e45c7..2451a752 100644 --- a/src/syntax_mapping.rs +++ b/src/syntax_mapping.rs @@ -57,6 +57,11 @@ impl<'a> SyntaxMapping<'a> { .insert("*.conf", MappingTarget::MapToUnknown) .unwrap(); + // Re-insert a mapping for resolv.conf, see #1510 + mapping + .insert("resolv.conf", MappingTarget::MapTo("resolv")) + .unwrap(); + for glob in &[ "/etc/nginx/**/*.conf", "/etc/nginx/sites-*/**/*", diff --git a/tests/syntax-tests/create_highlighted_versions.py b/tests/syntax-tests/create_highlighted_versions.py index 4319f47a..75ae9a4d 100755 --- a/tests/syntax-tests/create_highlighted_versions.py +++ b/tests/syntax-tests/create_highlighted_versions.py @@ -12,7 +12,7 @@ BAT_OPTIONS = [ "--no-config", "--style=plain", "--color=always", - "--theme='1337'", + "--theme=default", "--italic-text=always", ] @@ -41,7 +41,9 @@ def create_highlighted_versions(output_basepath): root = os.path.dirname(os.path.abspath(__file__)) sources = path.join(root, "source", "*") - for source in glob.glob(path.join(sources, "*")) + glob.glob(path.join(sources, ".*")): + for source in glob.glob(path.join(sources, "*")) + glob.glob( + path.join(sources, ".*") + ): try: env = os.environ.copy() env.pop("PAGER", None) diff --git a/tests/syntax-tests/highlighted/resolv.conf/resolv.conf b/tests/syntax-tests/highlighted/resolv.conf/resolv.conf new file mode 100644 index 00000000..f0448562 --- /dev/null +++ b/tests/syntax-tests/highlighted/resolv.conf/resolv.conf @@ -0,0 +1,4 @@ +[38;2;117;113;94m# A comment[0m +[38;2;249;38;114mdomain[0m[38;2;248;248;242m example.com[0m +[38;2;249;38;114mnameserver[0m[38;2;248;248;242m 192.168.123.123[0m +[38;2;249;38;114mnameserver[0m[38;2;248;248;242m aa00::aaaa:0000:1234:abcd[0m diff --git a/tests/syntax-tests/source/resolv.conf/resolv.conf b/tests/syntax-tests/source/resolv.conf/resolv.conf new file mode 100644 index 00000000..def2f2d9 --- /dev/null +++ b/tests/syntax-tests/source/resolv.conf/resolv.conf @@ -0,0 +1,4 @@ +# A comment +domain example.com +nameserver 192.168.123.123 +nameserver aa00::aaaa:0000:1234:abcd |