Last active
December 16, 2015 03:49
-
-
Save phinze/5372273 to your computer and use it in GitHub Desktop.
example of a homebrew external command with a start to categorized cask listing built for conversation in https://github.com/phinze/homebrew-cask/issues/198
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BREW_CASK_PREFIX = `brew --prefix brew-cask`.chomp | |
$LOAD_PATH << File.join(BREW_CASK_PREFIX, 'rubylib') | |
require 'cask' | |
module CaskCategories | |
CATEGORIES = { | |
'adium' => 'chat', | |
'rdio' => 'music', | |
'firefox' => 'browser', | |
'google-chrome' => 'browser' | |
} | |
def self.category_for(cask) | |
CATEGORIES[cask.title] || 'no-category' | |
end | |
end | |
puts "Here's a categorized list of casks:" | |
Cask.all.select(&:installed?).each do |cask| | |
puts "cask: #{cask.title}, category: #{CaskCategories.category_for(cask)}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ brew casklist | |
Here's a categorized list of casks: | |
cask: adium, category: chat | |
cask: bartender, category: no-category | |
cask: caffeine, category: no-category | |
cask: f-lux, category: no-category | |
cask: firefox, category: browser | |
cask: gfxcardstatus, category: no-category | |
cask: google-chrome, category: browser | |
cask: istat-menus, category: no-category | |
cask: keepass-x, category: no-category | |
cask: lime-chat, category: no-category | |
cask: mou, category: no-category | |
cask: rdio, category: music | |
cask: skitch, category: no-category | |
cask: slate, category: no-category | |
cask: steam, category: no-category | |
cask: transmission, category: no-category | |
cask: vine-server, category: no-category | |
cask: vlc, category: no-category |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment