Comments (8)
One way would perhaps be to add a single option, that allows passing any options to the actually used diff backend
Finally got around to implementing that at #1697
from delta.
Hi Chris, ok I'm sorry to say something that sounds silly, but isn't the answer -U0
?? As in git show -U0
? Or is the issue that you want this when doing delta file_1 file_2
?
from delta.
Hey Dan.
Oh yes, I was thinking about the delta file_1 file_2
case.
But your answer made me realise that I could at least get the behaviour via diff -U0 a b | delta
.
Nevertheless, would be nicer if it would work straight from delta.
from delta.
Right, my feeling has always been that it would be a mess to try to add the various diff options (actually git diff options) into delta's command-line parsing. delta a b
is actually[1] a shorthand for git diff --no-index a b
(a rather little-known command that allows git diff
to be used on any arbitrary pair of files) and so my stock answer here is to say "would you mind just using git diff --no-index a b ... | delta
?" and admitting that perhaps I should never have implemented the delta a b
shorthand!
[1] of course, this may have started out true but is not quite true any longer... we implemented support for things like delta <(echo a) <(echo b)
which is an improvement over
$ git diff --no-index <(echo a) <(echo b)
error: /dev/fd/11: unsupported file type
fatal: cannot hash /dev/fd/11
from delta.
To justify "a mess" -- it's that delta at heart is really a tool that takes in diff / grep / blame input and outputs unparseable stuff to look at. And it has a pretty large collection of options for doing that! So one hesitates before adding options for generating the diff output.
from delta.
Right, my feeling has always been that it would be a mess to try to add the various diff options (actually git diff options) into delta's command-line parsing.
One way would perhaps be to add a single option, that allows passing any options to the actually used diff
backend, be it git diff
(which probably then also uses diff
) or as in my example above diff
itself.
That way you could allow people to give options, but don't have to handle each of them manually in your parsing.
delta a b
is actually[1] a shorthand forgit diff --no-index a b
Out of curiosity: Also if git
is not available? Or would it then use diff
?
"would you mind just using
git diff --no-index a b ... | delta
?"
Well I would probably do so, if the above idea isn't an alternative for you either. ;-) It does however make life at least a tin bit more complicated in usage, as one needs (at least in scripting) to check diff
βs exit status, which would be lost because of he pipe.
If delta
would handle things internally (and does proper error handling), that could be avoided.
and admitting that perhaps I should never have implemented the
delta a b
shorthand!
I personally rather like the idea that delta
is also standalone and not fully tied to git
. Especially as it can also be used with diff
/grep
, as you said above.
Thanks,
Chris.
from delta.
One way would perhaps be to add a single option, that allows passing any options to the actually used diff backend
OK I think you're right, that seems to makes sense. Any interest in implementing? I have to admit I am low on spare programming time currently due to day job. (But trying to at least keep up with the nice PRs and issue suggestions that come in).
if git is not available? Or would it then use diff?
Actually no, not currently, but that would be an easy fix to make I think:
Lines 26 to 30 in dcae5bc
from delta.
Thanks :-)
from delta.
Related Issues (20)
- π Incorrect syntax-highlight with comment tag "#"
- π [Docs] Show the default config values HOT 1
- π Extra newline before diffs
- π Empty diff for proc files
- [Feature Request] Show percentage of how far the entire diff has been read
- `git grep -l` replaces first `-` with a `:` HOT 1
- Not working in Ubuntu 22.04 as intendedπ
- π inserted/deleted blank lines are sometimes hard to see
- Specify light and dark themes simultaneously, and auto-switch based on system appearance HOT 1
- π ripgrep JSON output causes panic with UTF character
- π PAGER env variable will omit command line parameters
- Weird EOL characters in side-by-side diff output ( ^[[0K )
- π Mouse scroll not working in jetbrains ide's terminal
- π output using html <ins> and <del> tags
- π Printing special terminal control characters "^[]11;rgb:0000/0000/0000^G" HOT 2
- π Memory allocation error for non root user HOT 1
- π Dark theme doesn't seem to be working HOT 2
- π Show when a directory as a whole was renamed, instead of each file inside it
- some tests fail with unicode-width v0.1.13
- π Updating bat cache with new theme crashes delta HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from delta.