Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions crates/zizmor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use std::{
use annotate_snippets::{Level, Renderer};
use anstream::{eprintln, println, stream::IsTerminal};
use anyhow::{Context, Result, anyhow};
use camino::{Utf8Path, Utf8PathBuf};
use clap::{Args, CommandFactory, Parser, ValueEnum};
use camino::Utf8Path;
use clap::{Args, CommandFactory, Parser, ValueEnum, builder::NonEmptyStringValueParser};
use clap_complete::Generator;
use clap_verbosity_flag::InfoLevel;
use config::Config;
Expand Down Expand Up @@ -69,7 +69,7 @@ struct App {
offline: bool,

/// The GitHub API token to use.
#[arg(long, env)]
#[arg(long, env, value_parser = NonEmptyStringValueParser::new())]
gh_token: Option<String>,

/// The GitHub Server Hostname. Defaults to github.com
Expand Down Expand Up @@ -101,8 +101,14 @@ struct App {

/// The configuration file to load. By default, any config will be
/// discovered relative to $CWD.
#[arg(short, long, env = "ZIZMOR_CONFIG", group = "conf")]
config: Option<Utf8PathBuf>,
#[arg(
short,
long,
env = "ZIZMOR_CONFIG",
group = "conf",
value_parser = NonEmptyStringValueParser::new()
)]
config: Option<String>,

/// Disable all configuration loading.
#[arg(long, group = "conf")]
Expand All @@ -123,7 +129,7 @@ struct App {
/// The directory to use for HTTP caching. By default, a
/// host-appropriate user-caching directory will be used.
#[arg(long)]
cache_dir: Option<Utf8PathBuf>,
cache_dir: Option<String>,

/// Control which kinds of inputs are collected for auditing.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/zizmor/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub(crate) struct AuditState<'a> {
impl<'a> AuditState<'a> {
pub(crate) fn new(app: &App, config: &'a Config) -> Self {
let cache_dir = match &app.cache_dir {
Some(cache_dir) => cache_dir.as_std_path().to_path_buf(),
Some(cache_dir) => PathBuf::from(cache_dir),
None => choose_app_strategy(AppStrategyArgs {
top_level_domain: "io.github".into(),
author: "woodruffw".into(),
Expand Down