Skip to content

Honor default-language option#1655

Merged
dandavison merged 2 commits into
dandavison:mainfrom
imbrish:default-language
Mar 16, 2024
Merged

Honor default-language option#1655
dandavison merged 2 commits into
dandavison:mainfrom
imbrish:default-language

Conversation

@imbrish

@imbrish imbrish commented Mar 16, 2024

Copy link
Copy Markdown
Contributor

Supersedes pull request #859. See also discussion #858. Fixes #499.

The actual code changes were made by @dandavison in that pull request, here I have only added tests.

Take diff:

diff --git a/abc b/abc
index 8c4ae06..0a37de7 100644
--- a/abc
+++ b/abc
@@ -9,7 +9,7 @@ foobar()
     dst=$(winpath $2)
 
     # List the directory.
-    ls -l $src
+    ls -la $src
 
     echo $src '->' $dst
     rsync -avu --delete $src/ $dst

And command:

cat diff | delta --no-gitconfig --default-language bash

Output before and after:

image

@imbrish

imbrish commented Mar 16, 2024

Copy link
Copy Markdown
Contributor Author

The failing check is the usual test_env_parsing_with_pager_set_to_bat. All tests pass locally, and this is ready to merge.

@dandavison dandavison merged commit 34e3367 into dandavison:main Mar 16, 2024
@dandavison

dandavison commented Mar 16, 2024

Copy link
Copy Markdown
Owner

Excellent, thanks a lot!

For anyone looking to use this, one way is to add an entry like

[delta]
    default-language = bash

to your repo's .git/config (that way you can choose the language per-repo).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀 --language option as bat

2 participants