summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-06-28 15:00:42 -0400
committerDan Davison <dandavison7@gmail.com>2020-06-28 15:36:16 -0400
commit5d4b8f51a949806b20b133dde0faeaaf35a0efd5 (patch)
tree0bf86ce30cd3ef2bf79760678d1e7d88fe7d5aed
parente0c07a77323bad71d82043f1418d2538ade5a7e3 (diff)
Rename option: color-only => raw
-rw-r--r--Makefile2
-rw-r--r--README.v0.2.0.md7
-rwxr-xr-xci/script.sh2
-rw-r--r--completion/completion.bash2
-rw-r--r--src/cli.rs4
-rw-r--r--src/features/mod.rs23
-rw-r--r--src/features/raw.rs (renamed from src/features/color_only.rs)2
-rw-r--r--src/rewrite_options.rs2
-rw-r--r--src/set_options.rs12
-rw-r--r--src/tests/test_example_diffs.rs12
-rwxr-xr-xtests/test_raw_output_matches_git_on_full_repo_history (renamed from tests/test_color_only_output_matches_git_on_full_repo_history)2
11 files changed, 33 insertions, 37 deletions
diff --git a/Makefile b/Makefile
index 0c1fd3a8..fef74676 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ unit-test:
cargo test
end-to-end-test: build
- ./tests/test_color_only_output_matches_git_on_full_repo_history
+ ./tests/test_raw_output_matches_git_on_full_repo_history
./tests/test_deprecated_options > /dev/null
release:
diff --git a/README.v0.2.0.md b/README.v0.2.0.md
index 837d80f4..2996bbfd 100644
--- a/README.v0.2.0.md
+++ b/README.v0.2.0.md
@@ -204,7 +204,7 @@ Set delta to be git's pager in your `.gitconfig`. Delta accepts many command lin
theme = 'Monokai Extended'
[interactive]
- diffFilter = delta --color-only
+ diffFilter = delta --raw
```
Note that delta argument values in ~/.gitconfig should be in double quotes, like `--minus-color="#340001"`. For a theme name containing a space, use single quotes, like `--theme='Monokai Extended'`.
@@ -375,7 +375,7 @@ FLAGS:
the file labels used see --file-modified-label, --file-removed-label, --file-added-
label, --file-renamed-label
-n, --line-numbers Display line numbers next to the diff. See LINE NUMBERS section
- --color-only Do not alter the input in any way other than applying colors. Equivalent to
+ --raw Do not alter the input in any way other than applying colors. Equivalent to
`--keep-plus-minus-markers --width variable --tabs 0 --commit-decoration '' --file-
decoration '' --hunk-decoration ''`
--no-gitconfig Do not take settings from git config files. See GIT CONFIG section
@@ -427,8 +427,7 @@ OPTIONS:
Style (foreground, background, attributes) for non-emphasized sections of added lines that have an
emphasized section. Defaults to --plus-style. See STYLES section [default: auto auto]
--commit-style <commit-style>
- Style (foreground, background, attributes) for the commit hash line. See STYLES section [default:
- raw]
+ Style (foreground, background, attributes) for the commit hash line. See STYLES section [default: raw]
--commit-decoration-style <commit-decoration-style>
Style (foreground, background, attributes) for the commit hash decoration. See STYLES section. One of the
special attributes 'box', 'ul', 'overline', or 'underoverline' must be given [default: ]
diff --git a/ci/script.sh b/ci/script.sh
index 0237e644..e6e505ad 100755
--- a/ci/script.sh
+++ b/ci/script.sh
@@ -9,7 +9,7 @@ cargo build --target "$TARGET" --verbose
if [[ $TARGET != arm-unknown-linux-gnueabihf ]] && [[ $TARGET != aarch64-unknown-linux-gnu ]]; then
cargo test --target "$TARGET" --verbose
cargo build --release
- ./tests/test_color_only_output_matches_git_on_full_repo_history
+ ./tests/test_raw_output_matches_git_on_full_repo_history
./tests/test_deprecated_options > /dev/null
cargo run --target "$TARGET" -- < /dev/null
diff --git a/completion/completion.bash b/completion/completion.bash
index bb0a5ba9..9bb27207 100644
--- a/completion/completion.bash
+++ b/completion/completion.bash
@@ -16,7 +16,7 @@ _delta() {
shopt -s extglob
local commands=(
- --color-only
+ --raw
--commit-style
--dark
--file-style
diff --git a/src/cli.rs b/src/cli.rs
index 8b705f27..f513c985 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -349,11 +349,11 @@ pub struct Opt {
#[structopt(long = "line-numbers-right-style", default_value = "auto")]
pub line_numbers_right_style: String,
- #[structopt(long = "color-only")]
+ #[structopt(long = "raw")]
/// Do not alter the input in any way other than applying colors. Equivalent to
/// `--keep-plus-minus-markers --width variable --tabs 0 --commit-decoration ''
/// --file-decoration '' --hunk-decoration ''`.
- pub color_only: bool,
+ pub raw: bool,
#[structopt(long = "no-gitconfig")]
/// Do not take settings from git config files. See GIT CONFIG section.
diff --git a/src/features/mod.rs b/src/features/mod.rs
index f5ada716..b7293bff 100644
--- a/src/features/mod.rs
+++ b/src/features/mod.rs
@@ -27,10 +27,6 @@ type OptionValueFunction = Box<dyn Fn(&cli::Opt, &Option<GitConfig>) -> Provenan
pub fn make_builtin_features() -> HashMap<String, BuiltinFeature> {
vec![
(
- "color-only".to_string(),
- color_only::make_feature().into_iter().collect(),
- ),
- (
"diff-highlight".to_string(),
diff_highlight::make_feature().into_iter().collect(),
),
@@ -46,6 +42,7 @@ pub fn make_builtin_features() -> HashMap<String, BuiltinFeature> {
"navigate".to_string(),
navigate::make_feature().into_iter().collect(),
),
+ ("raw".to_string(), raw::make_feature().into_iter().collect()),
]
.into_iter()
.collect()
@@ -73,11 +70,11 @@ macro_rules! builtin_feature {
}
}
-pub mod color_only;
pub mod diff_highlight;
pub mod diff_so_fancy;
pub mod line_numbers;
pub mod navigate;
+pub mod raw;
#[cfg(test)]
pub mod tests {
@@ -131,21 +128,21 @@ pub mod tests {
assert_eq!(
make_options(
- &["--features", "navigate color-only"],
+ &["--features", "navigate raw"],
Some(git_config_contents),
Some(git_config_path),
)
.features,
- "navigate color-only"
+ "navigate raw"
);
assert_eq!(
make_options(
- &["--navigate", "--features", "color-only"],
+ &["--navigate", "--features", "raw"],
Some(git_config_contents),
Some(git_config_path),
)
.features,
- "navigate color-only"
+ "navigate raw"
);
remove_file(git_config_path).unwrap();
@@ -161,12 +158,12 @@ pub mod tests {
"delta__test_feature_flag_on_command_line_does_not_replace_features_in_gitconfig.gitconfig";
assert_eq!(
make_options(
- &["--navigate", "--color-only"],
+ &["--navigate", "--raw"],
Some(git_config_contents),
Some(git_config_path),
)
.features,
- "my-feature navigate color-only"
+ "my-feature raw navigate"
);
remove_file(git_config_path).unwrap();
@@ -190,12 +187,12 @@ pub mod tests {
assert_eq!(
make_options(
- &["--color-only", "--features", "d a"],
+ &["--raw", "--features", "d a"],
Some(git_config_contents),
Some(git_config_path),
)
.features,
- "color-only diff-so-fancy f e d diff-highlight c b a"
+ "raw diff-so-fancy f e d diff-highlight c b a"
);
remove_file(git_config_path).unwrap();
diff --git a/src/features/color_only.rs b/src/features/raw.rs
index 1179822f..d0aa5335 100644
--- a/src/features/color_only.rs
+++ b/src/features/raw.rs
@@ -3,7 +3,7 @@ use crate::features::OptionValueFunction;
pub fn make_feature() -> Vec<(String, OptionValueFunction)> {
builtin_feature!([
(
- "color-only",
+ "raw",
bool,
None,
_opt => true
diff --git a/src/rewrite_options.rs b/src/rewrite_options.rs
index a7919610..41aa76bc 100644
--- a/src/rewrite_options.rs
+++ b/src/rewrite_options.rs
@@ -1,6 +1,6 @@
/// This module applies rewrite rules to the command line options, in order to
/// 1. Express deprecated usages in the new non-deprecated form
-/// 2. Implement options such as --color-only which are defined to be equivalent to some set of
+/// 2. Implement options such as --raw which are defined to be equivalent to some set of
/// other options.
use std::process;
diff --git a/src/set_options.rs b/src/set_options.rs
index c141e666..bfd841ea 100644
--- a/src/set_options.rs
+++ b/src/set_options.rs
@@ -71,7 +71,7 @@ pub fn set_options(
set_options!(
[
("24-bit-color", true_color),
- ("color-only", color_only),
+ ("raw", raw),
("commit-decoration-style", commit_decoration_style),
("commit-style", commit_style),
("dark", dark),
@@ -149,10 +149,10 @@ pub fn set_options(
/// - `e`, followed by e's "ordered descendents"
/// - `d`, followed by d's "ordered descendents"
///
-/// 4. Suppose the main [delta] section has `diff-highlight = true` followed by `color-only = true`.
+/// 4. Suppose the main [delta] section has `diff-highlight = true` followed by `raw = true`.
/// Then
/// - `diff-highlight`
-/// - `color-only`
+/// - `raw`
///
/// The "ordered descendents" of a feature `f` is a list of features obtained via a pre-order
/// traversal of the feature tree rooted at `f`. This tree arises because it is allowed for a
@@ -195,9 +195,6 @@ fn gather_features<'a>(
// Gather builtin feature flags supplied on command line.
// TODO: Iterate over programatically-obtained names of builtin features.
- if opt.color_only {
- features.push_front("color-only".to_string());
- }
if opt.diff_highlight {
features.push_front("diff-highlight".to_string());
}
@@ -210,6 +207,9 @@ fn gather_features<'a>(
if opt.navigate {
features.push_front("navigate".to_string());
}
+ if opt.raw {
+ features.push_front("raw".to_string());
+ }
if let Some(git_config) = git_config {
// Gather features from [delta] section if --features was not passed.
diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs
index 305e51d8..ad378077 100644
--- a/src/tests/test_example_diffs.rs
+++ b/src/tests/test_example_diffs.rs
@@ -140,7 +140,7 @@ mod tests {
DIFF_EXHIBITING_STATE_MACHINE_PARSER_BUG,
DIFF_EXHIBITING_TRUNCATION_BUG,
] {
- let config = integration_test_utils::make_config(&["--color-only"]);
+ let config = integration_test_utils::make_config(&["--raw"]);
let output = integration_test_utils::run_delta(input, &config);
assert_eq!(strip_ansi_codes(&output), input);
assert_ne!(output, input);
@@ -153,7 +153,7 @@ mod tests {
DIFF_WITH_UNRECOGNIZED_PRECEDING_MATERIAL_1,
DIFF_WITH_UNRECOGNIZED_PRECEDING_MATERIAL_2,
] {
- let config = integration_test_utils::make_config(&["--color-only"]);
+ let config = integration_test_utils::make_config(&["--raw"]);
let output = integration_test_utils::run_delta(input, &config);
assert_eq!(strip_ansi_codes(&output), input);
assert_ne!(output, input);
@@ -170,8 +170,8 @@ mod tests {
}
#[test]
- fn test_diff_with_merge_conflict_is_passed_on_unchanged_under_color_only() {
- let config = integration_test_utils::make_config(&["--color-only"]);
+ fn test_diff_with_merge_conflict_is_passed_on_unchanged_under_raw() {
+ let config = integration_test_utils::make_config(&["--raw"]);
let output = integration_test_utils::run_delta(DIFF_WITH_MERGE_CONFLICT, &config);
assert_eq!(strip_ansi_codes(&output), DIFF_WITH_MERGE_CONFLICT);
}
@@ -1120,8 +1120,8 @@ impl<'a> Alignment<'a> { │
}
#[test]
- fn test_color_only() {
- let config = integration_test_utils::make_config(&["--color-only"]);
+ fn test_raw() {
+ let config = integration_test_utils::make_config(&["--raw"]);
let output = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, &config);
ansi_test_utils::assert_line_is_syntax_highlighted(
&output,
diff --git a/tests/test_color_only_output_matches_git_on_full_repo_history b/tests/test_raw_output_matches_git_on_full_repo_history
index c654863c..8dcde90f 100755
--- a/tests/test_color_only_output_matches_git_on_full_repo_history
+++ b/tests/test_raw_output_matches_git_on_full_repo_history
@@ -1,4 +1,4 @@
#!/bin/bash
-DELTA="./target/release/delta --no-gitconfig --color-only"
+DELTA="./target/release/delta --no-gitconfig --raw"
GIT_ARGS="log --patch --stat --numstat"
diff -u <(git $GIT_ARGS | perl -pe 's/\e\[[0-9;]*[mK]//g') <(git $GIT_ARGS | $DELTA | perl -pe 's/\e\[[0-9;]*[mK]//g')