|
|
|
|
@ -155,15 +155,15 @@ fn app() -> clap::Command {
|
|
|
|
|
// This takes no effect.
|
|
|
|
|
Arg::new("nop_unified")
|
|
|
|
|
.short('u')
|
|
|
|
|
.action(ArgAction::SetTrue)
|
|
|
|
|
.hide(true)
|
|
|
|
|
)
|
|
|
|
|
.arg(
|
|
|
|
|
Arg::new("label").short('L')
|
|
|
|
|
.long("label")
|
|
|
|
|
.takes_value(true)
|
|
|
|
|
.value_name("LABEL")
|
|
|
|
|
.max_occurrences(2)
|
|
|
|
|
.allow_invalid_utf8(true)
|
|
|
|
|
.action(ArgAction::Append)
|
|
|
|
|
.value_parser(value_parser!(OsString))
|
|
|
|
|
.help("Label of file(s) which should be used for printing instead of PATH(s).")
|
|
|
|
|
)
|
|
|
|
|
.arg(
|
|
|
|
|
@ -807,8 +807,11 @@ pub(crate) fn parse_args() -> Mode {
|
|
|
|
|
[lhs_path, rhs_path] => {
|
|
|
|
|
let lhs_arg = FileArgument::from_cli_argument(lhs_path);
|
|
|
|
|
let rhs_arg = FileArgument::from_cli_argument(rhs_path);
|
|
|
|
|
let display_path = if matches.is_present("label") {
|
|
|
|
|
let labels: Vec<_> = matches.values_of_os("label").unwrap_or_default().collect();
|
|
|
|
|
let display_path = if matches.contains_id("label") {
|
|
|
|
|
let labels: Vec<_> = matches
|
|
|
|
|
.get_many::<OsString>("label")
|
|
|
|
|
.unwrap_or_default()
|
|
|
|
|
.collect();
|
|
|
|
|
let (_lhs_display_path, rhs_display_path) = match &labels[..] {
|
|
|
|
|
[lhs_display_path, rhs_display_path] => (
|
|
|
|
|
lhs_display_path.to_string_lossy().to_string(),
|
|
|
|
|
@ -819,7 +822,8 @@ pub(crate) fn parse_args() -> Mode {
|
|
|
|
|
display_path.to_string_lossy().to_string(),
|
|
|
|
|
),
|
|
|
|
|
_ => {
|
|
|
|
|
unreachable!("clap has already validated label")
|
|
|
|
|
eprintln!("More than 2 labels specified");
|
|
|
|
|
std::process::exit(EXIT_BAD_ARGUMENTS);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
rhs_display_path
|
|
|
|
|
|