summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2022-01-15 20:59:57 -0500
committerGitHub <noreply@github.com>2022-01-15 20:59:57 -0500
commitf498544dfd0ffe7d1a3edbfef65a5067ad50091d (patch)
tree9f927d7c06093f60bf36a6c0abd781c41f00e39e
parenta2038166d64f5cef5c5436590560d08467ca596d (diff)
structopt to clap (#889)
Replace structopt with clap Fixes #888 * Drop tests of deprecated options They were failing
-rw-r--r--Cargo.lock111
-rw-r--r--Cargo.toml2
-rw-r--r--src/cli.rs840
-rw-r--r--src/config.rs1
-rw-r--r--src/options/rewrite.rs36
-rw-r--r--src/options/set.rs7
-rw-r--r--src/subcommands/show_syntax_themes.rs10
7 files changed, 531 insertions, 476 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 63df7763..79982fd9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -28,15 +28,6 @@ dependencies = [
[[package]]
name = "ansi_term"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
-dependencies = [
- "winapi",
-]
-
-[[package]]
-name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
@@ -172,17 +163,32 @@ dependencies = [
[[package]]
name = "clap"
-version = "2.33.3"
+version = "3.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
+checksum = "f6f34b09b9ee8c7c7b400fe2f8df39cafc9538b03d6ba7f4ae13e4cb90bfbb7d"
dependencies = [
- "ansi_term 0.11.0",
"atty",
"bitflags",
+ "clap_derive",
+ "indexmap",
+ "lazy_static",
+ "os_str_bytes",
"strsim",
+ "termcolor",
"textwrap",
- "unicode-width",
- "vec_map",
+]
+
+[[package]]
+name = "clap_derive"
+version = "3.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41a0645a430ec9136d2d701e54a95d557de12649a9dd7109ced3187e648ac824"
+dependencies = [
+ "heck",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "syn",
]
[[package]]
@@ -351,13 +357,14 @@ name = "git-delta"
version = "0.11.3"
dependencies = [
"ansi_colours",
- "ansi_term 0.12.1",
+ "ansi_term",
"atty",
"bitflags",
"box_drawing",
"bytelines",
"chrono",
"chrono-humanize",
+ "clap",
"console",
"ctrlc",
"dirs-next",
@@ -373,7 +380,6 @@ dependencies = [
"serde_json",
"shell-words",
"smol_str",
- "structopt",
"syntect",
"sysinfo",
"unicode-segmentation",
@@ -436,12 +442,9 @@ dependencies = [
[[package]]
name = "heck"
-version = "0.3.2"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac"
-dependencies = [
- "unicode-segmentation",
-]
+checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hermit-abi"
@@ -571,9 +574,9 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
[[package]]
name = "memchr"
-version = "2.3.4"
+version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
+checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]]
name = "memoffset"
@@ -664,6 +667,15 @@ dependencies = [
]
[[package]]
+name = "os_str_bytes"
+version = "6.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
name = "palette"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -801,18 +813,18 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
[[package]]
name = "proc-macro2"
-version = "1.0.24"
+version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
+checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
dependencies = [
"unicode-xid",
]
[[package]]
name = "quote"
-version = "1.0.8"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df"
+checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d"
dependencies = [
"proc-macro2",
]
@@ -990,39 +1002,15 @@ dependencies = [
[[package]]
name = "strsim"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
-
-[[package]]
-name = "structopt"
-version = "0.3.25"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "40b9788f4202aa75c240ecc9c15c65185e6a39ccdeb0fd5d008b98825464c87c"
-dependencies = [
- "clap",
- "lazy_static",
- "structopt-derive",
-]
-
-[[package]]
-name = "structopt-derive"
-version = "0.4.18"
+version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
-dependencies = [
- "heck",
- "proc-macro-error",
- "proc-macro2",
- "quote",
- "syn",
-]
+checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
-version = "1.0.57"
+version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4211ce9909eb971f111059df92c45640aad50a619cf55cd76476be803c4c68e6"
+checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7"
dependencies = [
"proc-macro2",
"quote",
@@ -1086,12 +1074,9 @@ dependencies = [
[[package]]
name = "textwrap"
-version = "0.11.0"
+version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
-dependencies = [
- "unicode-width",
-]
+checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
[[package]]
name = "time"
@@ -1189,12 +1174,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
[[package]]
-name = "vec_map"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
-
-[[package]]
name = "version_check"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 6f46bcf1..845e81d1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,6 +23,7 @@ atty = "0.2.14"
bitflags = "1.3.2"
box_drawing = "0.1.2"
bytelines = "2.2.2"
+clap = { version = "3.0.5", features = ["derive"] }
console = "0.15.0"
ctrlc = "3.2.1"
dirs-next = "2.0.0"
@@ -36,7 +37,6 @@ serde = { version = "1.0.118", features = ["derive"] }
serde_json = "1.0.70"
shell-words = "1.0.0"
smol_str = "0.1.21"
-structopt = "0.3.25"
unicode-segmentation = "1.8.0"
unicode-width = "0.1.9"
vte = "0.10.1"
diff --git a/src/cli.rs b/src/cli.rs
index ed169809..cbc828b1 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -2,26 +2,25 @@ use std::collections::{HashMap, HashSet};
use std::ffi::OsString;
use std::path::PathBuf;
+use clap::{AppSettings, ColorChoice, FromArgMatches, IntoApp, Parser};
use lazy_static::lazy_static;
-use structopt::clap::AppSettings::{ColorAlways, ColoredHelp, DeriveDisplayOrder};
-use structopt::{clap, StructOpt};
use syntect::highlighting::Theme as SyntaxTheme;
use syntect::parsing::SyntaxSet;
+use crate::config::delta_unreachable;
use crate::git_config::{GitConfig, GitConfigEntry};
use crate::options;
use crate::utils::bat::assets::HighlightingAssets;
use crate::utils::bat::output::PagingMode;
-// No Default trait as this ignores `default_value = ..`
-#[derive(StructOpt)]
-#[structopt(
+#[derive(Parser)]
+#[clap(
name = "delta",
about = "A viewer for git and diff output",
- setting(ColorAlways),
- setting(ColoredHelp),
- setting(DeriveDisplayOrder),
- after_help = "\
+ version,
+ color = ColorChoice::Always,
+ setting(AppSettings::DeriveDisplayOrder),
+ after_long_help = "\
GIT CONFIG
----------
@@ -204,632 +203,746 @@ https://github.com/dandavison/delta/issues.
"
)]
pub struct Opt {
- /// Use default colors appropriate for a light terminal background. For more control, see the
- /// style options and --syntax-theme.
- #[structopt(long = "light")]
+ #[clap(long = "light")]
+ /// Use default colors appropriate for a light terminal background.
+ ///
+ /// For more control, see the style options and --syntax-theme.
pub light: bool,
- /// Use default colors appropriate for a dark terminal background. For more control, see the
- /// style options and --syntax-theme.
- #[structopt(long = "dark")]
+ #[clap(long = "dark")]
+ /// Use default colors appropriate for a dark terminal background.
+ ///
+ /// For more control, see the style options and --syntax-theme.
pub dark: bool,
- /// Display line numbers next to the diff. See LINE NUMBERS section.
- #[structopt(short = "n", long = "line-numbers")]
+ #[clap(short = 'n', long = "line-numbers")]
+ /// Display line numbers next to the diff.
+ ///
+ /// See LINE NUMBERS section.
pub line_numbers: bool,
- /// Display a side-by-side diff view instead of the traditional view.
- #[structopt(short = "s", long = "side-by-side")]
+ #[clap(short = 's', long = "side-by-side")]
+ /// Display diffs in side-by-side layout.
pub side_by_side: bool,
- #[structopt(long = "diff-highlight")]
- /// Emulate diff-highlight (https://github.com/git/git/tree/master/contrib/diff-highlight)
+ #[clap(long = "diff-highlight")]
+ /// Emulate diff-highlight.
+ ///
+ /// (https://github.com/git/git/tree/master/contrib/diff-highlight)
pub diff_highlight: bool,
- #[structopt(long = "diff-so-fancy")]
- /// Emulate diff-so-fancy (https://github.com/so-fancy/diff-so-fancy)
+ #[clap(long = "diff-so-fancy")]
+ /// Emulate diff-so-fancy.
+ ///
+ /// (https://github.com/so-fancy/diff-so-fancy)
pub diff_so_fancy: bool,
- #[structopt(long = "navigate")]
- /// Activate diff navigation: use n to jump forwards and N to jump backwards. To change the
- /// file labels used see --file-modified-label, --file-removed-label, --file-added-label,
- /// --file-renamed-label.
+ #[clap(long = "navigate")]
+ /// Activate diff navigation.
+ ///
+ /// Use n to jump forwards and N to jump backwards. To change the file labels used see
+ /// --file-modified-label, --file-removed-label, --file-added-label, --file-renamed-label.
pub navigate: bool,
- #[structopt(long = "relative-paths")]
- /// Output all file paths relative to the current directory so that they
- /// resolve correctly when clicked on or used in shell commands.
+ #[clap(long = "relative-paths")]
+ /// Output all file paths relative to the current directory.
+ ///
+ /// This means that they will resolve correctly when clicked on or used in shell commands.
pub relative_paths: bool,
- #[structopt(long = "hyperlinks")]
- /// Render commit hashes, file names, and line numbers as hyperlinks,
- /// according to the hyperlink spec for terminal emulators:
- /// https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda. By
- /// default, file names and line numbers link to the local file using a file
- /// URL, whereas commit hashes link to the commit in GitHub, if the remote
- /// repository is hosted by GitHub. See --hyperlinks-file-link-format for
- /// full control over the file URLs emitted. Hyperlinks are supported by
- /// several common terminal emulators. To make them work, you must use less
- /// version >= 581 with the -R flag (or use -r with older less versions, but
- /// this will break e.g. --navigate). If you use tmux, then you will also
- /// need a patched fork of tmux (see https://github.com/dandavison/tmux).
+ #[clap(long = "hyperlinks")]
+ /// Render commit hashes, file names, and line numbers as hyperlinks.
+ ///
+ /// Following the hyperlink spec for terminal emulators:
+ /// https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda. By default, file names
+ /// and line numbers link to the local file using a file URL, whereas commit hashes link to the
+ /// commit in GitHub, if the remote repository is hosted by GitHub. See
+ /// --hyperlinks-file-link-format for full control over the file URLs emitted. Hyperlinks are
+ /// supported by several common terminal emulators. To make them work, you must use less version
+ /// >= 581 with the -R flag (or use -r with older less versions, but this will break e.g.
+ /// --navigate). If you use tmux, then you will also need a patched fork of tmux (see
+ /// https://github.com/dandavison/tmux).
pub hyperlinks: bool,
- #[structopt(long = "keep-plus-minus-markers")]
- /// Prefix added/removed lines with a +/- character, exactly as git does. By default, delta
- /// does not emit any prefix, so code can be copied directly from delta's output.
+ #[clap(long = "keep-plus-minus-markers")]
+ /// Prefix added/removed lines with a +/- character, as git does.
+ ///
+ /// By default, delta does not emit any prefix, so code can be copied directly from delta's
+ /// output.
pub keep_plus_minus_markers: bool,
- /// Display the active values for all Delta options. Style options are displayed with
- /// foreground and background colors. This can be used to experiment with colors by combining
- /// this option with other options such as --minus-style, --zero-style, --plus-style, --light,
- /// --dark, etc.
- #[structopt(long = "show-config")]
+ #[clap(long = "show-config")]
+ /// Display the active values for all Delta options.
+ ///
+ /// Style string options are displayed with foreground and background colors. This can be used to
+ /// experiment with colors by combining this option with other options such as --minus-style,
+ /// --zero-style, --plus-style, --light, --dark, etc.
pub show_config: bool,
+ #[clap(long = "list-languages")]
/// List supported languages and associated file extensions.
- #[structopt(long = "list-languages")]
pub list_languages: bool,
+ #[clap(long = "list-syntax-themes")]
/// List available syntax-highlighting color themes.
- #[structopt(long = "list-syntax-themes")]
pub list_syntax_themes: bool,
- /// Show all available syntax-highlighting themes, each with an example of highlighted diff output.
+ #[clap(long = "show-syntax-themes")]
+ /// Show example diff for available syntax-highlighting themes.
+ ///
/// If diff output is supplied on standard input then this will be used for the demo. For
/// example: `git show | delta --show-syntax-themes`.
- #[structopt(long = "show-syntax-themes")]
pub show_syntax_themes: bool,
- /// Show available delta themes, each with an example of highlighted diff
- /// output. A delta theme is a delta named feature (see --features) that
- /// sets either `light` or `dark`. See
- /// https://github.com/dandavison/delta#custom-color-themes. If diff output
- /// is supplied on standard input then this will be used for the demo. For
- /// example: `git show | delta --show-themes`. By default shows dark or
- /// light themes only, according to whether delta is in dark or light mode
- /// (as set by the user or inferred from BAT_THEME). To control the themes
- /// shown, use --dark or --light, or both, on the command line together with
- /// this option.
- #[structopt(long = "show-themes")]
+ #[clap(long = "show-themes")]
+ /// Show example diff for available delta themes.
+ ///
+ /// A delta theme is a delta named feature (see --features) that sets either `light` or `dark`.
+ /// See https://github.com/dandavison/delta#custom-color-themes. If diff output is supplied on
+ /// standard input then this will be used for the demo. For example: `git show | delta
+ /// --show-themes`. By default shows dark or light themes only, according to whether delta is in
+ /// dark or light mode (as set by the user or inferred from BAT_THEME). To control the themes
+ /// shown, use --dark or --light, or both, on the command line together with this option.
pub show_themes: bool,
- /// Show available named colors. In addition to named colors, arbitrary
- /// colors can be specified using RGB hex codes. See COLORS section.
- #[structopt(long = "show-colors")]
+ #[clap(long = "show-colors")]
+ /// Show available named colors.
+ ///
+ /// In addition to named colors, arbitrary colors can be specified using RGB hex codes. See
+ /// COLORS section.
pub show_colors: bool,
- /// Parse ANSI color escape sequences in input and display them as git style
- /// strings. Example usage: git show --color=always | delta --parse-ansi
+ #[clap(long = "parse-ansi")]
+ /// Display ANSI color escape sequences in human-readable form.
+ ///
+ /// Example usage: git show --color=always | delta --parse-ansi
/// This can be used to help identify input style strings to use with map-styles.
- #[structopt(long = "parse-ansi")]
pub parse_ansi: bool,
- #[structopt(long = "no-gitconfig")]
- /// Do not take any settings from git config. See GIT CONFIG section.
+ #[clap(long = "no-gitconfig")]
+ /// Do not read any settings from git config.
+ ///
+ /// See GIT CONFIG section.
pub no_gitconfig: bool,
- #[structopt(long = "raw")]
- /// Do not alter the input in any way. This is mainly intended for testing delta.
+ #[clap(long = "raw")]
+ /// Do not alter the input in any way.
+ ///
+ /// This is mainly intended for testing delta.
pub raw: bool,
- #[structopt(long = "color-only")]
- /// Do not alter the input structurally in any way, but color and highlight hunk lines
- /// according to your delta configuration. This is mainly intended for other tools that use
- /// delta.
+ #[clap(long = "color-only")]
+ /// Do not alter the input structurally in any way.
+ ///
+ /// But color and highlight hunk lines according to your delta configuration. This is mainly
+ /// intended for other tools that use delta.
pub color_only: bool,
////////////////////////////////////////////////////////////////////////////////////////////
- #[structopt(long = "features")]
- /// Name of delta features to use (space-separated). A feature is a named collection of delta
- /// options in ~/.gitconfig. See FEATURES section. The environment variable DELTA_FEATURES can
- /// be set to a space-separated list of feature names. If this is preceded with a space, the
- /// features from the environment variable will be added to those specified in git config. E.g.
- /// DELTA_FEATURES=+side-by-side can be used to activate side-by-side temporarily.
+ #[clap(long = "features")]
+ /// Names of delta features to activate (space-separated).
+ ///
+ /// A feature is a named collection of delta options in ~/.gitconfig. See FEATURES section. The
+ /// environment variable DELTA_FEATURES can be set to a space-separated list of feature names.
+ /// If this is preceded with a space, the features from the environment variable will be added
+ /// to those specified in git config. E.g. DELTA_FEATURES=+side-by-side can be used to activate
+ /// side-by-side temporarily.
pub features: Option<String>,
- #[structopt(long = "syntax-theme")]
- /// The code syntax-highlighting theme to use. Use --show-syntax-themes to demo available
- /// themes. Defaults to the value of the BAT_THEME environment variable, if that contains a
- /// valid theme name. --syntax-theme=none disables all syntax highlighting.
+ #[clap(long = "syntax-theme")]
+ /// The syntax-highlighting theme to use.
+ ///
+ /// Use --show-syntax-themes to demo available themes. Defaults to the value of the BAT_THEME
+ /// environment variable, if that contains a valid theme name. --syntax-theme=none disables all
+ /// syntax highlighting.
pub syntax_theme: Option<String>,
- #[structopt(long = "minus-style", default_value = "normal auto")]
- /// Style (foreground, background, attributes) for removed lines. See STYLES section.
+ #[clap(long = "minus-style", default_value = "normal auto")]
+ /// Style string for removed lines.
+ ///
+ /// See STYLES section.
pub minus_style: String,
- #[structopt(long = "zero-style", default_value = "syntax normal")]
- /// Style (foreground, background, attributes) for unchanged lines. See STYLES section.
+ #[clap(long = "zero-style", default_value = "syntax normal")]
+ /// Style string for unchanged lines.
+ ///
+ /// See STYLES section.
pub zero_style: String,
- #[structopt(long = "plus-style", default_value = "syntax auto")]
- /// Style (foreground, background, attributes) for added lines. See STYLES section.
+ #[clap(long = "plus-style", default_value = "syntax auto")]
+ /// Style string for added lines.
+ ///
+ /// See STYLES section.
pub plus_style: String,
- #[structopt(long = "minus-emph-style", default_value = "normal auto")]
- /// Style (foreground, background, attributes) for emphasized sections of removed lines. See
- /// STYLES section.
+ #[clap(long = "minus-emph-style", default_value = "normal auto")]
+ /// Style string for emphasized sections of removed lines.
+ ///
+ /// See STYLES section.
pub minus_emph_style: String,
- #[structopt(long = "minus-non-emph-style", default_value = "minus-style")]
- /// Style (foreground, background, attributes) for non-emphasized sections of removed lines
- /// that have an emphasized section. See STYLES section.
+ #[clap(long = "minus-non-emph-style", default_value = "minus-style")]
+ /// Style string for non-emphasized sections of removed lines that have an emphasized section.
+ ///
+ /// See STYLES section.
pub minus_non_emph_style: String,
- #[structopt(long = "plus-emph-style", default_value = "syntax auto")]
- /// Style (foreground, background, attributes) for emphasized sections of added lines. See
- /// STYLES section.
+ #[clap(long = "plus-emph-style", default_value = "syntax auto")]
+ /// Style string for emphasized sections of added lines.
+ ///
+ /// See STYLES section.
pub plus_emph_style: String,
- #[structopt(long = "plus-non-emph-style", default_value = "plus-style")]
- /// Style (foreground, background, attributes) for non-emphasized sections of added lines that
- /// have an emphasized section. See STYLES section.
+ #[clap(long = "plus-non-emph-style", default_value = "plus-style")]
+ /// Style string for non-emphasized sections of added lines that have an emphasized section.
+ ///
+ /// See STYLES section.
pub plus_non_emph_style: String,
- #[structopt(long = "commit-style", default_value = "raw")]
- /// Style (foreground, background, attributes) for the commit hash line. See STYLES section.
- /// The style 'omit' can be used to remove the commit hash line from the output.
+ #[clap(long = "commit-style", default_value = "raw")]
+ /// Style string for the commit hash line.
+ ///
+ /// See STYLES section. The style 'omit' can be used to remove the commit hash line from the
+ /// output.
pub commit_style: String,
- #[structopt(long = "commit-decoration-style", default_value = "")]
- /// Style (foreground, background, attributes) for the commit hash decoration. See STYLES
- /// section. The style string should contain one of the special attributes 'box', 'ul'
- /// (underline), 'ol' (overline), or the combination 'ul ol'.
+ #[clap(long = "commit-decoration-style", default_value = "")]
+ /// Style string for the commit hash decoration.
+ ///
+ /// See STYLES section. The style string should contain one of the special attributes 'box',
+ /// 'ul' (underline), 'ol' (overline), or the combination 'ul ol'.
pub commit_decoration_style: String,
- /// The regular expression used to identify the commit line when parsing git output.
- #[structopt(long = "commit-regex", default_value = r"^commit ")]
+ #[clap(long = "commit-regex", default_value = r"^commit ")]
+ /// Regular expression used to identify the commit line when parsing git output.
pub commit_regex: String,
- #[structopt(long = "file-style", default_value = "blue")]
- /// Style (foreground, background, attributes) for the file section. See STYLES section. The
- /// style 'omit' can be used to remove the file section from the output.
+ #[clap(long = "file-style", default_value = "blue")]
+ /// Style string for the file section.
+ ///
+ /// See STYLES section. The style 'omit' can be used to remove the file section from the output.
pub file_style: String,
- #[structopt(long = "file-decoration-style", default_value = "blue ul")]
- /// Style (foreground, background, attributes) for the file decoration. See STYLES section. The
- /// style string should contain one of the special attributes 'box', 'ul' (underline), 'ol'
- /// (overline), or the combination 'ul ol'.
+ #[clap(long = "file-decoration-style", default_value = "blue ul")]
+ /// Style string for the file decoration.
+ ///
+ /// See STYLES section. The style string should contain one of the special attributes 'box',
+ /// 'ul' (underline), 'ol' (overline), or the combination 'ul ol'.
pub file_decoration_style: String,
#[structopt(long = "file-transformation")]
- /// A sed-style command specifying how file paths should be transformed for display.
+ /// A sed-style command transforming file paths for display.
pub file_regex_replacement: Option<String>,
- /// Format string for commit hyperlinks (requires --hyperlinks). The
- /// placeholder "{commit}" will be replaced by the commit hash. For example:
+ #[clap(long = "hyperlinks-commit-link-format")]
+ /// Format string for commit hyperlinks (requires --hyperlinks).
+ ///
+ /// The placeholder "{commit}" will be replaced by the commit hash. For example:
/// --hyperlinks-commit-link-format='https://mygitrepo/{commit}/'
- #[structopt(long = "hyperlinks-commit-link-format")]
pub hyperlinks_commit_link_format: Option<String>,
- /// Format string for file hyperlinks (requires --hyperlinks). The
- /// placeholders "{path}" and "{line}" will be replaced by the absolute file
- /// path and the line number, respectively. The default value of this option
- /// creates hyperlinks using standard file URLs; your operating system
- /// should open these in the application registered for that file type.
- /// However, these do not make use of the line number. In order for the link
- /// to open the file at the correct line number, you could use a custom URL
- /// format such as "file-line://{path}:{line}" and register an application
- /// to handle the custom "file-line" URL scheme by opening the file in your
- /// editor/IDE at the indicated line number. See
+ #[clap(long = "hyperlinks-file-link-format", default_value = "file://{path}")]
+ /// Format string for file hyperlinks (requires --hyperlinks).
+ ///
+ /// The placeholders "{path}" and "{line}" will be replaced by the absolute file path and the
+ /// line number, respectively. The default value of this option creates hyperlinks using
+ /// standard file URLs; your operating system should open these in the application registered
+ /// for that file type. However, these do not make use of the line number. In order for the link
+ /// to open the file at the correct line number, you could use a custom URL format such as
+ /// "file-line://{path}:{line}" and register an application to handle the custom "file-line" URL
+ /// scheme by opening the file in your editor/IDE at the indicated line number. See
/// https://github.com/dandavison/open-in-editor for an example.
- #[structopt(long = "hyperlinks-file-link-format", default_value = "file://{path}")]
pub hyperlinks_file_link_format: String,
- #[structopt(long = "hunk-header-style", default_value = "line-number syntax")]
- /// Style (foreground, background, attributes) for the hunk-header. See STYLES section. Special
- /// attributes 'file' and 'line-number' can be used to include the file path, and number of
- /// first hunk line, in the hunk header. The style 'omit' can be used to remove the hunk header
- /// section from the output.
+ #[clap(long = "hunk-header-style", default_value = "line-number syntax")]
+ /// Style string for the hunk-header.
+ ///
+ /// See STYLES section. Special attributes 'file' and 'line-number' can be used to include the
+ /// file path, and number of first hunk line, in the hunk header. The style 'omit' can be used
+ /// to remove the hunk header section from the output.
pub hunk_header_style: String,
- #[structopt(long = "hunk-header-file-style", default_value = "blue")]
- /// Style (foreground, background, attributes) for the file path part of the hunk-header. See
- /// STYLES section. The file path will only be displayed if hunk-header-style contains the
+ #[clap(long = "hunk-header-file-style", default_value = "blue")]
+ /// Style string for the file path part of the hunk-header.
+ ///
+ /// See STYLES section. The file path will only be displayed if hunk-header-style contains the
/// 'file' special attribute.
pub hunk_header_file_style: String,
- #[structopt(long = "hunk-header-line-number-style", default_value = "blue")]
- /// Style (foreground, background, attributes) for the line number part of the hunk-header. See
- /// STYLES section. The line number will only be displayed if hunk-header-style contains the
+ #[clap(long = "hunk-header-line-number-style", default_value = "blue")]
+ /// Style string for the line number part of the hunk-header.
+ ///
+ /// See STYLES section. The line number will only be displayed if hunk-header-style contains the
/// 'line-number' special attribute.
pub hunk_header_line_number_style: String,
- #[structopt(long = "hunk-header-decoration-style", default_value = "blue box")]
- /// Style (foreground, background, attributes) for the hunk-header decoration. See STYLES
- /// section. The style string should contain one of the special attributes 'box', 'ul'
- /// (underline), 'ol' (overline), or the combination 'ul ol'.
+ #[clap(long = "hunk-header-decoration-style", default_value = "blue box")]
+ /// Style string for the hunk-header decoration.
+ ///
+ /// See STYLES section. The style string should contain one of the special attributes 'box',
+ /// 'ul' (underline), 'ol' (overline), or the combination 'ul ol'.
pub hunk_header_decoration_style: String,
- #[structopt(long = "merge-conflict-begin-symbol", default_value = "▼")]
- /// A string that is repeated to form the line marking the beginning of a merge conflict region.
+ #[clap(long = "merge-conflict-begin-symbol", default_value = "▼")]
+ /// String marking the beginning of a merge conflict region.
+ ///
+ /// The string will be repeated until it reaches the required length.
pub merge_conflict_begin_symbol: String,
- #[structopt(long = "merge-conflict-end-symbol", default_value = "▲")]
- /// A string that is repeated to form the line marking the end of a merge conflict region.
+ #[clap(long = "merge-conflict-end-symbol", default_value = "▲")]
+ /// String marking the end of a merge conflict region.
+ ///
+ /// The string will be repeated until it reaches the required length.
pub merge_conflict_end_symbol: String,
- #[structopt(
+ #[clap(
long = "merge-conflict-ours-diff-header-style",
default_value = "normal"
)]
- /// Style (foreground, background, attributes) for the header above the diff between the
- /// ancestral commit and 'our' branch. See STYLES section.
+ /// Style string for the header above the 'ours' branch merge conflict diff.
+ ///
+ /// See STYLES section.
pub merge_conflict_ours_diff_header_style: String,
- #[structopt(
+ #[clap(
long = "merge-conflict-ours-diff-header-decoration-style",
default_value = "box"
)]
- /// Style (foreground, background, attributes) for the decoration of the header above the diff
- /// between the ancestral commit and 'our' branch. See STYLES section. The style string should
- /// contain one of the special attributes 'box', 'ul' (underline), 'ol' (overline), or the
- /// combination 'ul ol'.
+ /// Style string for the decoration of the header above the 'ours' merge conflict diff.
+ ///
+ /// This styles the decoration of the header above the diff between the ancestral commit and the
+ /// 'ours' branch. See STYLES section. The