summaryrefslogtreecommitdiff
path: root/src/utils/process.rs
AgeCommit message (Collapse)Author
2025-01-09clippy 1.84 fixThomas Otto
2024-11-28Support external subcommands: rg, diff, git-show (etc.) (#1769)Thomas Otto
* Support external subcommands: rg, git show, git log (etc.) The possible command line now is: delta <delta-args> [SUBCMD <subcmd-args>] If the entire command line fails to parse because SUBCMD is unknown, then try (until the next arg fails) parsing <delta-args> only, and then parse and call SUBCMD.., its output is piped into delta. Other subcommands also take precedence over the diff/git-diff mode (`delta a b`, where e.g. a=git and b=show), and any diff call gets converted into an external subcommand first. Available are: delta rg .. => rg --json .. | delta delta a b .. => git diff a b .. | delta delta git show .. => git <color-on> show .. | delta and all other git-CMDS, of which add -p, blame, checkout -p, diff, grep, log -p, reflog -p, and stash show -p produce a diff. Because --json is automatically added for `delta rg ..`, it avoids the parsing ambiguities of and is easier to type than `rg .. | delta`. The piping is not done by the shell, but delta, so the subcommands are now child processes of delta. * Set calling process directly because delta started it This info then takes precedence over whatever start_determining_calling_process_in_thread() finds or rather doesn't find. (The simple yet generous SeqCst is used on purpose for the atomic operations.)
2024-09-22Improve blame file type detection (#1829)dvermd
Move blame to CallingProcess Signed-off-by: dvermd <315743+dvermd@users.noreply.github.com>
2024-09-15Do not double panic in FakeParentArgs::dropdvermd
Signed-off-by: dvermd <315743+dvermd@users.noreply.github.com>
2024-05-04clippy (#1686)Dan Davison
2024-05-04Repair --default-language, and highlight using full filename (#1549)Thomas Otto
* Fix clippy warnings * Repair --default-language, and highlight using full filename Fixed that the "txt" fallback was used instead of --default-language And when looking for syntax highlighting, keep the filename around as long as possible. Using simple custom logic (filename > 4) a Makefile can be highlighted with make syntax, but a 'cc' or 'ini' file does not get treated like a *.cc or *.ini file. Currently the underlying highlighting lib syntect and the sublime syntax definitions can not make this distinction (<http://www.sublimetext.com/docs/syntax.html>).
2024-02-19Accept clippy suggestions (#1632)Dan Davison
2023-03-03Spelling (#1257)Josh Soref
Corrects misspellings identified by https://github.com/marketplace/actions/check-spelling Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-02-28Fix clippy warnings (#1298)nickelc
* Fix clippy warnings - `clippy::uninlined_format_args` * Fix clippy warnings - `clippy::clone_on_copy` - `clippy::explicit_auto_deref` - `clippy::iter_cloned_collect` - `clippy::map_clone` - `clippy::needless_borrow` - `clippy::needless_lifetimes` - `clippy::needless_return` - `clippy::redundant_clone` - `clippy::redundant_field_names` - `clippy::seek_to_start_instead_of_rewind` - `clippy::unnecessary_cast` - `clippy::unused_unit`
2022-10-11Fix clippy warnings after rust 1.64 upgradeThomas Otto
2022-08-16Fix clippy warnings after rust 1.63 upgrademliszcz
Following fixes are included: * derive_partial_eq_without_eq: Eq trait was added by running `cargo clippy --fix --no-deps`. * get_first: Function was replaced by running `cargo clippy --fix --no-deps`. * unnecessary_to_owned: This check was disabled for ANSIString as to_string call is required to enforce formatting. Otherwise the underlying string was returned directly (probably due to Deref implementation). * type_complexity: Closure type was simplified and Box<> usage was removed.
2022-08-07Fix typos (#1151)Kian-Meng Ang
Found via following command: codespell -L crate,nin,numer,struc,ded,fo
2022-06-22Allow to run tests using "cargo t"Björn Steinbrink
The test_process_calling_cmdline test only allows "cargo test" and "cargo tarpaulin" for running the testsuite, for "cargo t" is a built-in alias for "cargo test" and should be allowed, too.
2022-03-01Disable full process scans on LinuxThomas Otto
The env var DELTA_CALLING_PROCESS_QUERY_ALL re-enables this last resort method. However usually this is just an expensive scan which doesn't find the caller anyhow.
2022-03-01Also look at grandparent process when determining the callerThomas Otto
2022-02-14Fix hyperlink absolute paths (#939)Dan Davison
Fix file paths and hyperlinks With this commit the target of a hyperlink should always be an absolute path. This should be true for all file hyperlinks, e.g. - File hyperlink - Hunk header hyperlink - Line number hyperlink Fixes #890
2022-01-25Use sysinfo::Pid as less as possibleGuillaume Gomez
2022-01-25Update sysinfo version to 0.23Guillaume Gomez
2022-01-13Fix new 1.58 clippy lintsThomas Otto
2022-01-03Cache parent process when testing unless FakeParentArgs are usedThomas Otto
2022-01-03The calling process must have a common parent with deltaThomas Otto
Ensures that no unrelated process is found when selectively refreshing a pid range.
2022-01-03Move parent process query into a threadThomas Otto
Start the query even before determining if information about the parent process is required (which are most invocations anyhow).
2022-01-03Re-enable full process scans on LinuxThomas Otto
2022-01-03Disable /proc fd caching on Linux when querying processesThomas Otto
This query only happens once, so caching is not needed Also update sysinfo version to fix a crash related to this.
2021-12-11Do not query CPU data when querying process data (#845)Dan Davison
* Do not query CPU data when querying process data Fixes #839 Ref https://github.com/GuillaumeGomez/sysinfo/issues/632 * Update branch of sysinfo * Update upstream sysinfo commit Ref https://github.com/GuillaumeGomez/sysinfo/pull/636 * Point sysinfo at an explicit commit rather than a symbolic branch name commit d647acfbf216848a8237e1f9251b2c48860a547f Merge: 989ac6c 67a586c Author: Guillaume Gomez <guillaume1.gomez@gmail.com> Date: 2 hours ago Merge pull request #636 from GuillaumeGomez/update-if-needed Only update processors if needed
2021-12-11Query fewer processes when searching for the parentThomas Otto
This query now happens for more invocation types, so speed it up. Call `refresh_process()` only on pids numerically close to the one of delta itself.
2021-12-07Disable last-resort process tree inspectionDan Davison
See #824 in which some users are reporting very slow performance. Fixes #824
2021-12-07Fixed some test clippysThomas Otto
Note that currently `cargo clippy --tests` is not checked by the CI runs
2021-12-04Silence warningDan Davison
2021-12-02Fix new v1.57 clippy warningsThomas Otto
2021-11-29Do not handle --word-diff or --color-words outputDan Davison
Fixes #440 Ref #152
2021-11-29Refactor: parse command lineDan Davison
2021-11-29Test sibling process detectionThomas Otto
2021-11-29Match process binary case insensitivelyThomas Otto
2021-11-29Clean up FakeParentArgsThomas Otto
Can fake once, for_scope, or with a given list.
2021-11-24Do not recognize grep tools whose output we cannot currently parseDan Davison
Ref #794
2021-11-22Syntax-highlight `git show $revision:./path/to/file.ext` outputDan Davison
2021-11-22Handle grep outputDan Davison
- Handle standard filepath:code and filepath:line_number:code output as produced by `git grep`, `rg -H`, `grep -H`, etc (with -n for line numbers). - Retain the match highlighting as produced by the grep tool, and expose it in delta's color output styled with grep-match-style. (Note that --color=always is needed to retain the color if piping into delta, but not for `git grep` when delta is configured as git's pager) - Special handling of -p, and -W options of `git grep`: these display the function context in which the matches occur. - `navigate` keybindings jump between match function contexts under `git grep -p` and between matching lines under `git grep -W`. Thanks @zachriggle for the proposal. Fixes #769
2021-11-22Obtain parent git grep command line optionsDan Davison
2021-11-21Enable faking `extract_args()` parameters from process utils (#783)Thomas Otto
The fake value is valid for exactly one call, the state for this is stored per-thread.
2021-11-18Add ProcessInterfaceThomas Otto
2021-11-18Make process utils more genericThomas Otto
2021-11-15Refactor: utils moduleDan Davison