Move handling to dev-cmd/audit.rb

This commit is contained in:
Rylan Polster 2021-11-06 00:51:20 -04:00
parent 34204a499b
commit 46f7c8b0b6
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64
2 changed files with 12 additions and 9 deletions

View File

@ -27,15 +27,15 @@ module Cask
new_cask: nil) new_cask: nil)
# `new_cask` implies `online` and `strict` # `new_cask` implies `online` and `strict`
online = new_cask if online.blank? online = new_cask if online.nil?
strict = new_cask if strict.blank? strict = new_cask if strict.nil?
# `online` implies `appcast` and `download` # `online` implies `appcast` and `download`
appcast = online if appcast.nil? # `appcast` is `nil` if neither `--appcast` nor `--no-appcast` are passed appcast = online if appcast.nil?
download = online if download.blank? download = online if download.nil?
# `new_cask` implies `token_conflicts` # `new_cask` implies `token_conflicts`
token_conflicts = new_cask if token_conflicts.blank? token_conflicts = new_cask if token_conflicts.nil?
@cask = cask @cask = cask
@appcast = appcast @appcast = appcast

View File

@ -206,14 +206,17 @@ module Homebrew
require "cask/cmd/abstract_command" require "cask/cmd/abstract_command"
require "cask/cmd/audit" require "cask/cmd/audit"
# For switches, we add `|| nil` so that `nil` will be passed instead of `false` if they aren't set.
# This way, we can distinguish between "not set" and "set to false".
Cask::Cmd::Audit.audit_casks( Cask::Cmd::Audit.audit_casks(
*audit_casks, *audit_casks,
download: nil, download: nil,
# No need for `|| nil` because this is a `--[no-]appcast` and automatically sets itself to `nil` if not passed
appcast: args.appcast?, appcast: args.appcast?,
online: args.online?, online: args.online? || nil,
strict: args.strict?, strict: args.strict? || nil,
new_cask: args.new_cask?, new_cask: args.new_cask? || nil,
token_conflicts: args.token_conflicts?, token_conflicts: args.token_conflicts? || nil,
quarantine: nil, quarantine: nil,
any_named_args: !no_named_args, any_named_args: !no_named_args,
language: nil, language: nil,