-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Util: check parent process for filename #770
Conversation
Nice, this even works on windows, thanks to
|
Excellent! (There seem to be some test failures on one of the linux builds) |
src/utils.rs
Outdated
} | ||
|
||
None | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if there is a crate dedicated to parsing arbitrary command lines known only at run time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is more a command line ignorer than parser it is a rather simple function, see skip_uninteresting_args
.
Usecase: With delta used as a pager the command `git blame main.rs` calls delta, but the piped data does not mention the filename. Instead try to get the filename extension from the parent `git` process. If that fails try the direct sibling or all other `git blame` processes.
Updated to also work in other cases, such as piped input ( The tests failed on ARM because there they are not executed on hardware but in emulation, so I try to detect that. Also, |
Merged -- it looks like the only test complaints were clippy complaining that things were not called, as indeed they will not be until we use this in #761, and the coverage test for which I'll try adding Thanks very much for this -- it is already quite sophisticated. |
Usecase: With delta used as a pager the command
git blame main.rs
callsdelta, but the piped data does not mention the filename. Instead try to
get the filename extension from the parent
git
process.