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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# File 'lib/robbie/command.rb', line 42
def help(*args)
unless args.empty?
@args = args.first
@command = @args.first
end
if @command.nil?
advice = {
search: 'searches the query and returns the first 3 results',
info: 'provides extensive information on the query (ID)',
version: 'returns the current version',
help: 'return this help menu'
}
puts "usage: robbie [command] [arguments]"
advice.map do |key, value|
puts "#{key}\t\t#{value}"
end
exit
else
info = {
search: {
command: 'search',
example: 'robbie search movies "Pulp Fiction"',
description: 'searches the query and returns the first 3 results'
},
info: {
command: 'info',
example: 'robbie info tt0110912',
description: 'provides extensive information on the query (ID)'
},
version: {
command: 'version',
example: 'robbie version',
description: 'returns the current version',
},
help: {
command: 'help',
example: 'robbie help search',
description: 'return this help menu. if an optional command parameter is provided, a description and exmaple is returned'
}
}
if info.has_key? @command.to_sym
symInfo = info[@command.to_sym]
puts Rainbow("robbie #{symInfo[:command]}\n").white.bg(:black)
puts "Example: $ #{symInfo[:example]}\n"
puts "Description: #{symInfo[:description]}"
else
puts "No manual entry for #{@command}"
end
end
end
|