Class: StackFu::Commands::ListCommand
Constant Summary collapse
- TableAttributes =
{ Server => [ [:name, :key, :ip, :verified, :last_seen], lambda do |item| last_seen = item.last_checked_in if item.respond_to?(:last_checked_in) if last_seen last_seen = distance_of_time_in_words(Time.now, Time.parse(last_seen)) last_seen = "#{last_seen} ago" validated = "yes" else last_seen = "- never -" validated = "" end ip = item.respond_to?(:ip) ? item.ip : "" [item.slug, item._id, ip, validated, last_seen] end, "You have no servers yet. You can add new servers to your account in http://stackfu.com." ], Script => [ [:name, :description], lambda { |item| [item.name, (item.description || "").truncate_words(10)] }, "You have nothing to list yet. To generate a new script, use the 'stackfu generate' command." ] }
Constants included from Rendering
Constants included from OperatingSystems
OperatingSystems::FriendlyNames, OperatingSystems::OperatingSystems
Instance Attribute Summary
Attributes inherited from Command
#errors, #options, #parameters, #subcommand
Instance Method Summary collapse
- #default(parameters, options) ⇒ Object
- #scripts(parameters, options) ⇒ Object
- #servers(parameters, options) ⇒ Object
Methods included from DateHelper
display_time_in_words, distance_of_time, distance_of_time_hash, distance_of_time_in_percent, distance_of_time_in_words, distance_of_time_in_words_hash
Methods included from ApiHooks
Methods inherited from Command
#command, command_for, create, inherited, #initialize, #params?, #run, #valid?
Methods included from Rendering
#done, #error, #fill_values_from_options, #menu_for, #render_target, #spinner, #table, #warning
Methods included from OperatingSystems
Constructor Details
This class inherits a constructor from StackFu::Commands::Command
Instance Method Details
#default(parameters, options) ⇒ Object
50 51 52 |
# File 'lib/stackfu/commands/list_command.rb', line 50 def default(parameters, ) list [Script, Server] end |
#scripts(parameters, options) ⇒ Object
46 47 48 |
# File 'lib/stackfu/commands/list_command.rb', line 46 def scripts(parameters, ) list Script end |
#servers(parameters, options) ⇒ Object
42 43 44 |
# File 'lib/stackfu/commands/list_command.rb', line 42 def servers(parameters, ) list Server end |