diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb index 510b872f03e30d9866ad97a93dab0ed1c7e5ed9e..66fe520342476d97a0c2ac668362998540b75c09 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