Class: MM::Command::Cards
Direct Known Subclasses
View
Instance Method Summary
collapse
#cache_options, #card_property?, #display_value, #doc, #options, #output, #run, #user_property?
Instance Method Details
#do_once ⇒ Object
29
30
31
32
33
|
# File 'lib/mm/cmds/cards.rb', line 29
def do_once
params = options.reject{|key, value| key.to_s=~/^transition_script_template/}
output "card list params => #{params.inspect}"
find_cards(params)
end
|
#option_parser ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/mm/cmds/cards.rb', line 40
def option_parser
OptionParser.new do |opts|
opts.banner = "usage: mm cards [options]"
opts.separator ""
opts.separator "Environment variable options:"
opts.separator " MM_ATTRS => attributes want to be displayed"
opts.separator " Could be any param's name with 'MM' started, e.g. MM_VIEW='favorite name', MM_PAGE=1"
opts.separator ""
opts.separator "Synopsis:"
opts.separator "mm cards \"{:view => 'favorite/tab name'}\" => find cards by favorite's/tab's name"
opts.separator "mm cards \"{:view => 'favorite/tab name', :page => 2}\" => find cards in the page 2 by favorite's/tab's name"
opts.separator ""
opts.separator "Options:"
opts.on("-a att_name1,attr_name2", Array, "show specified attribute value.") do |names|
options[:attrs] = names
end
end
end
|
#parse(argv) ⇒ Object
35
36
37
38
|
# File 'lib/mm/cmds/cards.rb', line 35
def parse(argv)
view_options = argv.join(' ').strip
options.merge!(eval(view_options =~ /^\{.*\}$/ ? view_options : "{#{view_options}}"))
end
|
#view(cards) ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'lib/mm/cmds/cards.rb', line 19
def view(cards)
cards.each do |card|
output '----------'
output card.short_summarization
if options[:attrs]
output(card)
end
end
end
|