1
0
mirror of https://github.com/sharkdp/bat synced 2026-07-28 17:51:44 +00:00

Credit syntax definition and theme authors with new --acknowledgements option (#1971)

The text that is printed is generated when building assets, by analyzing LICENSE
and NOTICE files that comes with syntaxes and themes.

We take this opportunity to also add a NOTICE file as defined by Apache License 2.0.
This commit is contained in:
Martin Nordholts
2021-12-11 14:00:45 +01:00
committed by GitHub
parent 63ad53817d
commit a3ea798246
12 changed files with 325 additions and 7 deletions
+12
View File
@@ -508,6 +508,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
.hidden_short_help(true)
.help("Show diagnostic information for bug reports.")
)
.arg(
Arg::with_name("acknowledgements")
.long("acknowledgements")
.hidden_short_help(true)
.help("Show acknowledgements."),
)
.arg(
Arg::with_name("ignored-suffix")
.number_of_values(1)
@@ -578,6 +584,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
"Create completely new syntax and theme sets \
(instead of appending to the default sets).",
),
)
.arg(
Arg::with_name("acknowledgements")
.long("acknowledgements")
.requires("build")
.help("Build acknowledgements.bin."),
),
)
}
+10 -3
View File
@@ -47,9 +47,13 @@ fn build_assets(matches: &clap::ArgMatches) -> Result<()> {
.map(Path::new)
.unwrap_or_else(|| PROJECT_DIRS.cache_dir());
let blank = matches.is_present("blank");
bat::assets::build(source_dir, !blank, target_dir, clap::crate_version!())
bat::assets::build(
source_dir,
!matches.is_present("blank"),
matches.is_present("acknowledgements"),
target_dir,
clap::crate_version!(),
)
}
fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
@@ -324,6 +328,9 @@ fn run() -> Result<bool> {
} else if app.matches.is_present("cache-dir") {
writeln!(io::stdout(), "{}", cache_dir())?;
Ok(true)
} else if app.matches.is_present("acknowledgements") {
writeln!(io::stdout(), "{}", bat::assets::get_acknowledgements())?;
Ok(true)
} else {
run_controller(inputs, &config)
}