Sha256: 173207fbb63748d74c6fb674048efc599ca37145362ce21ec23a1619153e0f9c
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
#!/usr/bin/env ruby require 'thor' require 'my_help' require 'colorize' class MyCLI < Thor desc('setup', 'set up the test database') def setup(*args) $control = MyHelp::Control.new() end desc "list", "list all helps, specific HELP, or item" def list(*args) invoke :setup file = args[0] item = args[1] if file.nil? puts $control.list_all # list [] elsif item.nil? begin puts $control.list_help(file) # list [file] rescue => e puts e.to_s.red end else begin puts $control.show_item(file, item) # list [file] [item] rescue => e puts e.to_s.red end end end desc "edit {help_name}", "edit HELP_NAME" def edit(help_name) invoke :setup $control.edit_help(help_name) end desc "new {help_name}", "make new HELP_NAME" def new(help_name) invoke :setup $control.init_help(help_name) end desc "delete {help_name}", "delete HELP_NAME" def delete(help_name) invoke :setup $control.delete_help(help_name) end desc "tomo_upload {help_name}", "tomo_upload HELP_NAME" def tomo_upload(help_name) invoke :setup $control.upload_help(help_name) end desc "search {find_char}", "search FIND_CHAR" def search(find_char) invoke :setup $control.search_help(find_char) end end MyCLI.start(ARGV)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
my_help-0.8.6 | bin/my_help_thor |
my_help-0.8.5 | bin/my_help_thor |