From ac6295491c771c0da2856524b8e7bb39f1f7da72 Mon Sep 17 00:00:00 2001 From: Maxim Belkin Date: Wed, 12 Aug 2020 08:22:45 -0500 Subject: [PATCH] cmd/cleanup.rb: fix input handling --- Library/Homebrew/cmd/cleanup.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb index 510b872f03..66fe520342 100644 --- a/Library/Homebrew/cmd/cleanup.rb +++ b/Library/Homebrew/cmd/cleanup.rb @@ -33,6 +33,10 @@ module Homebrew def cleanup args = cleanup_args.parse + if args.prune.present? && !Integer(args.prune, exception: false) && args.prune != "all" + raise UsageError, "--prune= expects an integer or 'all'." + end + cleanup = Cleanup.new(*args.named, dry_run: args.dry_run?, scrub: args.s?, days: args.prune&.to_i) if args.prune_prefix? cleanup.prune_prefix_symlinks_and_directories