Skip to content

Commit

Permalink
Make -u option take no effect and hide from users.
Browse files Browse the repository at this point in the history
  • Loading branch information
futatuki committed Aug 27, 2023
1 parent ae09863 commit 838734c
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,11 @@ fn app() -> clap::Command<'static> {
.required(false),
)
.arg(
Arg::new("unified_default")
// Dummy 'unified' flag of POSIX/GNU diff utility for svn support:
// This takes no effect.
Arg::new("nop_unified")
.short('u')
.conflicts_with("display")
.help("Use inline style for display mode.")
.hide(true)
)
.arg(
Arg::new("label").short('L')
Expand Down Expand Up @@ -555,24 +556,20 @@ pub fn parse_args() -> Mode {
detect_display_width()
};

let display_mode = if matches.is_present("unified_default") {
DisplayMode::Inline
} else {
match matches.value_of("display").expect("display has a default") {
"side-by-side" => DisplayMode::SideBySide,
"side-by-side-show-both" => DisplayMode::SideBySideShowBoth,
"inline" => DisplayMode::Inline,
"json" => {
if env::var(format!("DFT_UNSTABLE")).is_err() {
eprintln!("JSON output is an unstable feature and its format may change in future. To enable JSON output, set the environment variable DFT_UNSTABLE=yes.");
std::process::exit(EXIT_BAD_ARGUMENTS);
}

DisplayMode::Json
}
_ => {
unreachable!("clap has already validated display")
let display_mode = match matches.value_of("display").expect("display has a default") {
"side-by-side" => DisplayMode::SideBySide,
"side-by-side-show-both" => DisplayMode::SideBySideShowBoth,
"inline" => DisplayMode::Inline,
"json" => {
if env::var(format!("DFT_UNSTABLE")).is_err() {
eprintln!("JSON output is an unstable feature and its format may change in future. To enable JSON output, set the environment variable DFT_UNSTABLE=yes.");
std::process::exit(EXIT_BAD_ARGUMENTS);
}

DisplayMode::Json
}
_ => {
unreachable!("clap has already validated display")
}
};

Expand Down

0 comments on commit 838734c

Please sign in to comment.