class CommandLine::SubCommands::ListCommand
Public Class Methods
new(new_args, new_input_stream = STDIN)
click to toggle source
Calls superclass method
CommandLine::Command::new
# File lib/git/contest/command_line/sub_commands/list_command.rb, line 15 def initialize(new_args, new_input_stream = STDIN) super Contest::Driver::Utils.load_plugins $config = get_config() || {} $sites = {} if $config.has_key? 'sites' $sites = $config["sites"] end end
Public Instance Methods
define_options()
click to toggle source
# File lib/git/contest/command_line/sub_commands/list_command.rb, line 27 def define_options end
run()
click to toggle source
# File lib/git/contest/command_line/sub_commands/list_command.rb, line 33 def run sub_commands = %w(sites drivers) type = next_token case type when "drivers" # show all drivers puts "#" puts "# Available Drivers" puts "#" puts "" drivers = Contest::Driver::Utils.get_all_drivers drivers.each {|driver_info| puts " #{driver_info[:class_name]}" puts " #{driver_info[:site_info][:desc]}" puts "" } when "sites" # show all sites $sites.keys.each do |site_name| puts "# #{site_name}" keys = ["driver", "user"] keys.each {|key| puts " %-8s: %s" % [ key, $sites[site_name][key] ] } puts " \n" end else usage end end
set_default_options()
click to toggle source
# File lib/git/contest/command_line/sub_commands/list_command.rb, line 30 def set_default_options end
Private Instance Methods
usage()
click to toggle source
Show Banner
# File lib/git/contest/command_line/sub_commands/list_command.rb, line 68 def usage puts get_banner return 0 end