diff --git a/src/options.rs b/src/options.rs index 47f503b55c..593e1a0285 100644 --- a/src/options.rs +++ b/src/options.rs @@ -5,6 +5,7 @@ use std::{env, ffi::OsStr, path::Path, path::PathBuf}; use clap::{crate_authors, crate_description, Arg, Command}; use const_format::formatcp; use crossterm::tty::IsTty; +use itertools::Itertools; use crate::{ display::style::BackgroundColor, @@ -467,7 +468,18 @@ fn parse_overrides_or_die(raw_overrides: &[String]) -> Vec<(LanguageOverride, Ve std::process::exit(EXIT_BAD_ARGUMENTS); } - res + res.into_iter() + .coalesce( + |(prev_lang, mut prev_globs), (current_lang, current_globs)| { + if prev_lang == current_lang { + prev_globs.extend(current_globs); + Ok((prev_lang, prev_globs)) + } else { + Err(((prev_lang, prev_globs), (current_lang, current_globs))) + } + }, + ) + .collect() } /// Parse CLI arguments passed to the binary. diff --git a/src/parse/guess_language.rs b/src/parse/guess_language.rs index ba6eedb5cd..824b3f009a 100644 --- a/src/parse/guess_language.rs +++ b/src/parse/guess_language.rs @@ -73,7 +73,7 @@ pub enum Language { Zig, } -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, PartialEq)] pub enum LanguageOverride { Language(Language), PlainText,