summaryrefslogtreecommitdiff
path: root/src/cli.rs
AgeCommit message (Collapse)Author
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-11-16Support {host} in hyperlinks (#1901)Dan Davison
* Support {host} in hyperlinks * Improve help text
2024-11-05Add optional capture-output writer to run_app()Thomas Otto
The output and exit code of run_app() are now testable, used for diff test.
2024-09-08Replace "light mode" bool with a dedicated enumTau Gärtli
2024-09-06Fix clippy warnings (#1851)Tau Gärtli
* Fix non-portable doc comments warning A line starting with > might be interpreted as a block quote. In regular markdown this could be prevented by escaping the `>` using a backslash. However, since the doc comments are used by clap for the long help more or less verbatim, the `\` would be visible hence the shuffling around of words. * Use `.contains()`
2024-08-15Support passing arguments to git diff and diff (#1697)Dan Davison
Adds --diff-args with short form -@.
2024-08-12Do not wrap short help (-h) outputThomas Otto
2024-08-01Use angle bracket around <urls>, regenerate help output markdownThomas Otto
2024-08-01Wrap --help output and use pagerThomas Otto
Tell clap to not wrap output, append `after_long_help()` (with matching ansi codes in this section), then manually wrap the result. The help output is now paginated if writing to a terminal. All code paths flow back to main(), so an invoked pager is properly waited for (by the OutputType drop impl).
2024-07-22Add --max-syntax-highlighting-length, set to 400Thomas Otto
--max-line-length increased to 3000, highlighting now stops after 400 characters. In that case the highlighting may be incorrect until it is reset for the next hunk.
2024-07-17Fix copy-paste typo (#1767)Justin Su
Accidentally introduced in #1744
2024-07-17Add missing `--file-*-label` option to `--navigate` docs (#1744)Justin Su
Also sort the options alphabetically
2024-06-24Don't read git files when --no-gitconfig is given + unused variables (#1728)Thomas Otto
* Fix unused variables * Don't read git files when --no-gitconfig is given Despite starting delta with `--no-gitconfig`, strace still shows that `.git/config` etc. files are accessed. By no longer doing that it is very clear that no config options are read from there.
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-03-12Detect Dark/Light Mode from Terminal (#1615)Tau
2023-11-19feat: generate completion subcommand (#1561)plustik
* generate-completion subcommand * add Makefile target and replace completion scripts in repo with generated output * Add completion to manual
2023-11-18fixed typos (#1553)Fritz Rehde
2023-07-29Update documentation regarding BAT_PAGERDan Davison
Ref #1467
2023-06-03Drop grep-header-style optionDan Davison
2023-06-02Introduce grep-output-type option: ripgrep or classicDan Davison
2023-05-31Misc tab refactoring (#1424)Thomas Otto
* Move tabs logic into utils * Re-use buffer returned by tabs::expand * Add TabCfg to configure tabs Use the String from this config for the tab replacement. This avoids creating a new String for each processed line. * Avoid unicode segmentation for each line just to remove a prefix In some code paths no prefix is removed, and in almost all other cases the prefix is just ascii. This simplifies a lot of calls. * Set default tab with to 8 Editors like vim, emacs, nano and most terminal emulators set this value as the default tab display width.
2023-03-15Remove manual line-wrapping (#1350)Dan Davison
Fixes #1316
2023-03-12Merge the different `GitConfig` constructors for a config file (#1342)nickelc
The `try_create_from_path` function and the `from_path` function for tests can be merged into a single function.
2023-03-10Derive the default for enums with `#[derive(Default)]`/`#[default]` (#1341)nickelc
2023-03-09Add methods for getting `GitConfig` as reference (#1336)nickelc
2023-03-08Get git's minus/plus style from config instead of copying it around (#1329)nickelc
2023-03-05Added config option. (#1324)Paolo Insogna
* feat: Added config option.
2023-03-03Update `clap` to 4.1 (#1322)nickelc
* Update to clap 4 * Add help, usage, error-context features to clap * Add wrap_help clap feature * Remove DeriveDisplayOrder as it is now default * Update ValueSource using statement * Update #[clap(...)] to #[command(...)] * Update #[clap(...)] to #[arg(...)] * Update #[structopt(...)] to #[arg(...)] * Remove value_parser because it is now default * Return option & argument names as `String` due to lifetime issues * Remove leading hyphens from arguments long definition Leading hyphens are no longer accepted. * Argument names are derived from field names and `snake_case` * `help` & `version` are no longer added automatically * Update `clap` to 4.1.8 --------- Co-authored-by: tjquillan <tjquillan@gmail.com>
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>
2022-12-04Address deprecated clap features (#1251)Thomas Quillan
* Address deprecated clap features * Move to Arg::get_id from Arg::get_name * Move to ArgMatches::value_source * Run rustfmt
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-16Support configurable timestamps in git blame output (#1157)mliszcz
New CLI/config option is introduced: blame-timestamp-output-format. Fixes #1157.
2022-06-25Fix documentation of DELTA_FEATURESDan Davison
2022-03-30Add custom env struct to store env at init (#1025)William Escande
This allow to no longer ignore some tests (marked previously as FIXME) by storing the env at the start of the program (Or creating a custom env for test purpose) This centralize almost alls calls to std::env inside one wrapper Add a test profile to increase speed for testing (5min -> 20sec on my machine) clean a few code style like this: ``` if Some(value) = ... if value ``` to ``` if Some(true) = ... ``` Co-authored-by: William Escande <wescande@google.com>
2022-03-21Fix typo in --help textDan Davison
2022-03-14Tweak wrap-max-lines documentationDan Davison
2022-02-27Use assets API from bat library instead of vendored code (#903)Dan Davison
Use assets API from bat library Fixes #895 Ref https://github.com/sharkdp/bat/issues/2026 Thanks @Enselic
2022-02-15Clarify language: "in front of" → "before" (#967)Waldir Pimenta
2022-01-21Show blame line numbers via blame-separator-formatThomas Otto
Prefix and suffix of the format string are separator-style highlighted, format options are none, {n}, {n:block}, {n:every-N}.
2022-01-19clap: Use term_width(0) instead of term_width(usize::MAX)Dan Davison
0 means "no wrap" https://github.com/clap-rs/clap/issues/3300#issuecomment-1015578541
2022-01-19Prevent clap from switching to multiline format for short helpDan Davison
Ref https://github.com/clap-rs/clap/issues/3300 Fixes #377
2022-01-18Center Align numbers right-ish (#883)Thomas Otto
There is no such thing as "Center Align" with discrete terminal cells. In some cases a decision has to be made whether to use the left or the right cell, e.g. when centering one char in 4 cells: "_X__" or "__X_". The format!() center/^ default is left, but when padding numbers these are now aligned to the right if required. Strings remain left-aligned.
2022-01-17Slight improvement on long cosmetic arg name in help outputDan Davison
2022-01-17More minimizing of cosmetic argument names in help outputDan Davison
2022-01-16Add a note about `delta -h` to the long help outputDan Davison
2022-01-16Sort options in --help outputDan Davison
2022-01-16Add clap cosmetic argument namesDan Davison
2022-01-16Drop deprecated options (#914)Dan Davison
Drop deprecated options Fixes #891
2022-01-15structopt to clap (#889)Dan Davison
Replace structopt with clap Fixes #888 * Drop tests of deprecated options They were failing
2022-01-06New option file-transformation to transform file pathsDan Davison