Module: Options
Class Method Summary collapse
Methods included from CommandParser
Methods included from Option
Methods included from Core
delete, help, install, save, use
Methods included from Response
delete, help, install, save, use
Methods included from Install
config, etc, scripts, tools, wallpapers
Methods included from FileSystem
Methods included from Sudo
Methods included from Get
Class Method Details
.parse ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/dotfiles/parse/options.rb', line 30 def self.parse OptionParser.new do |opts| opts.on('-h', '--help', 'Show help message') do Core.help end opts.on('-v', '--version', 'Show dotfiles version') do puts @version exit end end.parse! CommandParser.new do |opts| opts.on_empty do Core.help end opts.on('help') do |command| Core.help(command) end opts.on('install') do |link| if link.nil? Core.help('install') end Core.install(link) end opts.on('use') do |name| if name.nil? Core.help('use') end Core.use(name) end opts.on('save') do Core.save abort("No results were returned for that query") end opts.on('delete') do |name| if name.nil? Core.help('delete') end Core.delete(name) end end end |