Skip to content

Commit

Permalink
feat: add --strict option to enforce strict checking of configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Nov 26, 2022
1 parent b84ae6a commit aeb4a1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/plumbing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub fn main() -> Result<()> {
let config = config.clone();
move |mode: Mode| -> Result<git::Repository> {
let mut mapping: git::sec::trust::Mapping<git::open::Options> = Default::default();
let strict_toggle = matches!(mode, Mode::Strict | Mode::StrictWithGitInstallConfig);
let strict_toggle = matches!(mode, Mode::Strict | Mode::StrictWithGitInstallConfig) || args.strict;
mapping.full = mapping.full.strict_config(strict_toggle);
mapping.reduced = mapping.reduced.strict_config(strict_toggle);
let git_installation = matches!(
Expand Down
8 changes: 8 additions & 0 deletions src/plumbing/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ pub struct Args {
#[clap(long, conflicts_with("verbose"))]
pub progress: bool,

/// Don't default malformed configuration flags, but show an error instead.
///
/// Note that some subcommands use strict mode by default.
// TODO: needs a 'lenient' mutually exclusive counterpart. Opens the gate to auto-verbose some commands, and add --no-verbose
// for these.
#[clap(long, short = 's')]
pub strict: bool,

/// The progress TUI will stay up even though the work is already completed.
///
/// Use this to be able to read progress messages or additional information visible in the TUI log pane.
Expand Down

0 comments on commit aeb4a1d

Please sign in to comment.