Class: SocialSnippet::CommandLine::SSpm::SubCommands::SearchCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/social_snippet/command_line/sspm/sub_commands/search_command.rb

Instance Attribute Summary

Attributes inherited from Command

#args, #input_stream, #opt_parser, #options, #output_stream, #streams, #tokens

Instance Method Summary collapse

Methods inherited from Command

#define_option, #init, #initialize, #social_snippet

Constructor Details

This class inherits a constructor from SocialSnippet::CommandLine::Command

Instance Method Details

#define_optionsObject


15
16
17
18
19
20
# File 'lib/social_snippet/command_line/sspm/sub_commands/search_command.rb', line 15

def define_options
  define_option :name, :type => :flag, :short => true, :default => true
  define_option :desc, :type => :flag, :short => true, :default => true
  define_option :url, :type => :flag, :short => true, :default => false
  define_option :installed, :type => :flag, :short => true, :default => true
end

#descObject


11
12
13
# File 'lib/social_snippet/command_line/sspm/sub_commands/search_command.rb', line 11

def desc
  "Search for repository by keyword"
end

#runObject


22
23
24
25
26
27
28
# File 'lib/social_snippet/command_line/sspm/sub_commands/search_command.rb', line 22

def run
  if has_next_token?
    social_snippet.api.search_repositories next_token, options
  else
    help
  end
end

#usageObject


5
6
7
8
9
# File 'lib/social_snippet/command_line/sspm/sub_commands/search_command.rb', line 5

def usage
  <<EOF
Usage: sspm search [options] [--] <keyword>
EOF
end