aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/cli
diff options
context:
space:
mode:
authorValentin VĂLCIU2017-02-27 22:33:34 +0200
committerValentin VĂLCIU2017-03-15 22:58:25 +0200
commit7532545140c1ce0da370b2b3124e488dbb11fc41 (patch)
treed7d4862de884d9996dd30eb22c0393592863d7a1 /Library/Homebrew/cask/lib/hbc/cli
parent4d88cc4c41113be2d5bf11c11fa671c763705a64 (diff)
downloadbrew-7532545140c1ce0da370b2b3124e488dbb11fc41.tar.bz2
add command 'cask outdated'
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/cli')
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/outdated.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/outdated.rb b/Library/Homebrew/cask/lib/hbc/cli/outdated.rb
new file mode 100644
index 000000000..d608beab5
--- /dev/null
+++ b/Library/Homebrew/cask/lib/hbc/cli/outdated.rb
@@ -0,0 +1,39 @@
+module Hbc
+ class CLI
+ class Outdated < Base
+ def self.run(*args)
+ greedy = args.include?("--greedy")
+ verbose = ($stdout.tty? || CLI.verbose?) && !args.include?("--quiet")
+
+ cask_tokens = cask_tokens_from(args)
+ casks_to_check = if cask_tokens.empty?
+ Hbc.installed
+ else
+ cask_tokens.map { |token| Hbc.load(token) }
+ end
+
+ casks_to_check.each do |cask|
+ odebug "Checking update info of Cask #{cask}"
+ list_if_outdated(cask, greedy, verbose)
+ end
+ end
+
+ def self.list_if_outdated(cask, greedy, verbose)
+ return unless cask.outdated?(greedy)
+
+ if verbose
+ outdated_versions = cask.outdated_versions(greedy)
+ outdated_info = "#{cask.token} (#{outdated_versions.join(", ")})"
+ current_version = cask.version.to_s
+ puts "#{outdated_info} != #{current_version}"
+ else
+ puts cask.token
+ end
+ end
+
+ def self.help
+ "list the outdated installed Casks"
+ end
+ end
+ end
+end