Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/outdated: display warning for disabled casks #17124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions Library/Homebrew/cmd/outdated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
end

print_outdated(outdated)
print_disabled(disabled_casks)

Check warning on line 81 in Library/Homebrew/cmd/outdated.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cmd/outdated.rb#L81

Added line #L81 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned: if we output casks here: we should also output formulae. May also want to think about how --json is handled.

end

Homebrew.failed = args.named.present? && outdated.present?
Expand Down Expand Up @@ -123,6 +124,13 @@
end
end

def print_disabled(casks)
casks.each do |cask|
opoo "#{cask.token} is #{DeprecateDisable.message(cask)}"

Check warning on line 129 in Library/Homebrew/cmd/outdated.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cmd/outdated.rb#L128-L129

Added lines #L128 - L129 were not covered by tests
end
puts "Consider looking for alternatives, as they will be removed from Homebrew soon."

Check warning on line 131 in Library/Homebrew/cmd/outdated.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cmd/outdated.rb#L131

Added line #L131 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to handle this (and probably also the opoo above differently when STDOUT is not a TTY e.g. compare brew outdated and brew outdated | cat output.

end

def json_info(formulae_or_casks)
formulae_or_casks.map do |formula_or_cask|
if formula_or_cask.is_a?(Formula)
Expand Down Expand Up @@ -177,6 +185,14 @@
end
end

def disabled_casks
if args.named.present?

Check warning on line 189 in Library/Homebrew/cmd/outdated.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cmd/outdated.rb#L189

Added line #L189 was not covered by tests
select_disabled(args.named.to_casks)
else
select_disabled(Cask::Caskroom.casks)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use hyperfine to see how much slower this makes the default brew outdated?

end
end

def outdated_formulae_casks
formulae, casks = args.named.to_resolved_formulae_to_casks

Expand All @@ -198,6 +214,10 @@
end
end
end

def select_disabled(casks)
casks.select(&:disabled?)

Check warning on line 219 in Library/Homebrew/cmd/outdated.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cmd/outdated.rb#L219

Added line #L219 was not covered by tests
end
end
end
end