Comments (11)
Hi @calestyo, I thought that it worked like that already! Can you post an example? This is MacOS in zsh.
~ delta <(echo a) <(echo a) > /dev/null; echo $?
0
~ delta <(echo a) <(echo b) > /dev/null; echo $?
1
~ delta <(echo a) __not_there__ > /dev/null; echo $?
diff: __not_there__: No such file or directory
2
from delta.
Indeed. Not sure how I produced the contradicting result.... I've been calling delta
from a shell script, and I think there might have been an exit 1
at a wrong point, which has overridden delta
βs 2
.
Sorry for the noise.
btw: Is there a way in delta
to disable colour output?
from delta.
No worries.
btw: Is there a way in delta to disable colour output?
You mean, keep all the reformatting and decorations but specifically disable colour? I don't think there is a way to do that, although perhaps there are enough colour settings in delta to achieve it piecemeal!
So in a script the answer would be not to call delta if one only wants the raw git/diff input, and of course, git doesn't invoke delta at all if output is not a tty. But if you explicitly pipe to delta in a script then it will add colours and text decorations / reformatting.
from delta.
No worries.
I reproduced it... wait a second...
from delta.
$ touch foo
$ stat /tmp/bar
stat: cannot statx '/tmp/bar': No such file or directory
$ delta foo /tmp/bar ; echo $?
error: Could not access '/tmp/bar'
1
If I do however:
$ delta <(echo foo) /tmp/bar ; echo $?
diff: /tmp/bar: No such file or directory
2
from delta.
Ah-ha, I'm not at my computer but I do remember that the code handling process substitutions had to do something unfortunate. Feel free to investigate!
from delta.
There are more cases:
$ delta /dev/null non-existent
$ delta /dev/random non-existent
$ delta /dev/uinput non-existent
all give 1
, and only uinput
is permission-wise not accessible by the user.
Also:
$ ln -s /nonexistent dangling.symlink
$ delta dangling.symlink non-existent
Though it works when comparing with an existent file (not sure, btw. whether it should even then, cause then there's still one inaccessible file - the target of the dangling symlink).
from delta.
Also when doing using a directory as existent file:
$ delta /tmp non-existent
from delta.
That issue may even go yet a bit further.
Assume I do:
foo="$(diff -u a b)"
(and there is a difference)
and then:
printf '%s\n' "$foo" | delta
I get the differences shown, but exit status is 0
(and not 1
).
from delta.
That's right, in something | delta
delta behaves like cat or bat -- it's just a pager displaying stuff and exit code is 0 unless something goes wrong. On the other hand in delta a b
delta acts as a diff program, and exit codes are as diff
.
from delta.
Well unless for the other cases mentioned above, where one does have delta a b
style and it still doesn't act like diff
. :-)
from delta.
Related Issues (20)
- π test env::tests::test_env_parsing_with_pager_set_to_bat ... FAILED HOT 4
- π Always using light theme on dark background HOT 9
- π 0.17.0 seems much slower then 0.16.5 HOT 12
- π --navigate n/N jumps to next/prev hunk, not file? HOT 1
- RUSTSEC-2024-0320: yaml-rust is unmaintained.
- π Incorrect syntax-highlight with comment tag "#"
- π [Docs] Show the default config values
- π 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 `:`
- 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
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.