chore(cli): add --thanks (#951)

This commit is contained in:
William Woodruff 2025-06-18 12:43:41 -04:00 committed by GitHub
parent 18454b8242
commit e60eb434db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 24 additions and 4 deletions

View file

@ -67,7 +67,7 @@ Astral
<a href="https://grafana.com/">
<img src="https://avatars.githubusercontent.com/u/7195757?s=100&v=4" width="100px">
<br>
Grafana
Grafana Labs
</a>
</td>
</tr>

View file

@ -7,7 +7,7 @@ use std::{
};
use annotate_snippets::{Level, Renderer};
use anstream::{eprintln, stream::IsTerminal};
use anstream::{eprintln, println, stream::IsTerminal};
use anyhow::{Context, Result, anyhow};
use audit::{Audit, AuditLoadError};
use camino::{Utf8Path, Utf8PathBuf};
@ -23,6 +23,7 @@ use indicatif::ProgressStyle;
use owo_colors::OwoColorize;
use registry::{AuditRegistry, FindingRegistry, InputKey, InputKind, InputRegistry};
use state::AuditState;
use terminal_link::Link;
use tracing::{Span, info_span, instrument};
use tracing_indicatif::{IndicatifLayer, span_ext::IndicatifSpanExt};
use tracing_subscriber::{EnvFilter, layer::SubscriberExt as _, util::SubscriberInitExt as _};
@ -39,6 +40,10 @@ mod state;
mod utils;
mod yaml_patch;
// TODO: Dedupe this with the top-level `sponsors.json` used by the
// README + docs site.
const THANKS: &[(&str, &str)] = &[("Grafana Labs", "https://grafana.com")];
/// Finds security issues in GitHub Actions setups.
#[derive(Parser)]
#[command(about, version)]
@ -133,6 +138,10 @@ struct App {
#[arg(long, value_enum, value_name = "SHELL", exclusive = true)]
completions: Option<Shell>,
/// Emit thank-you messages for zizmor's sponsors.
#[arg(long, exclusive = true)]
thanks: bool,
/// Enable naches mode.
#[arg(long, hide = true, env = "ZIZMOR_NACHES")]
naches: bool,
@ -491,6 +500,15 @@ fn run() -> Result<ExitCode> {
let mut app = App::parse();
if app.thanks {
println!("zizmor's development is sustained by our generous sponsors:");
for (name, url) in THANKS {
let link = Link::new(name, url);
println!("🌈 {link}")
}
return Ok(ExitCode::SUCCESS);
}
if let Some(shell) = app.completions {
let mut cmd = App::command();
completions(shell, &mut cmd);

View file

@ -46,6 +46,8 @@ Options:
Fail instead of warning on syntax and schema errors in collected inputs
--completions <SHELL>
Generate tab completion scripts for the specified shell [possible values: bash, elvish, fish, nushell, powershell, zsh]
--thanks
Emit thank-you messages for zizmor's sponsors
-h, --help
Print help (see more with '--help')
-V, --version

View file

@ -14,7 +14,7 @@ Astral
<a href="https://grafana.com/">
<img src="https://avatars.githubusercontent.com/u/7195757?s=100&v=4" width="100px">
<br>
Grafana
Grafana Labs
</a>
</td>
</tr>

View file

@ -5,7 +5,7 @@
"img": "https://avatars.githubusercontent.com/u/115962839?s=100&v=4"
},
{
"name": "Grafana",
"name": "Grafana Labs",
"url": "https://grafana.com/",
"img": "https://avatars.githubusercontent.com/u/7195757?s=100&v=4"
},