🚀 Add --input-command option to tell delta the command line responsible for input
- Dominant language
- Rust
- Stars
- 32.2k
- Forks
- 572
- Avg merge
- 11m
- Merged PRs (30d)
- 1
Description
cc @th1000s Although delta tries, it's not always possible for it to identify the process (e.g. `grep`/`blame`/`git show` etc) responsible for generating its input. This is because when one does `grep pattern file.txt | delta`, the grep process may exit before delta interrogates the running system processes. (That outcome is somewhat less likely when one does `grep pattern large_codebase/**/*.rs`).
I suggest adding a command line option allowing users to do things like `grep -n pattern file.txt | head -n 100 | delta --input-command 'grep -n'`.
In terms of implementation, the parent process is cached on first call via [`lazy_static`](https://github.com/dandavison/delta/blob/8ff50afccb1d065b105db83eda19341c3458f964/src/utils/process.rs#L28-L30), and so we will need to find some way of getting the user options to that call.
Contributor guide
Research direction
Start in src/utils/process.rs, especially the lazy_static-cached parent-process logic referenced by the issue, and trace how command-line options reach it. Determine how --input-command should override process detection for piped input, then verify the example grep/head/delta invocation reports the supplied command.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100