Class: SocialSnippet::CommandLine::SSnip::MainCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/social_snippet/command_line/ssnip/main_command.rb

Instance Attribute Summary collapse

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 Attribute Details

#sub_commandsObject (readonly)

Returns the value of attribute sub_commands


5
6
7
# File 'lib/social_snippet/command_line/ssnip/main_command.rb', line 5

def sub_commands
  @sub_commands
end

Instance Method Details

#define_optionsObject


17
18
# File 'lib/social_snippet/command_line/ssnip/main_command.rb', line 17

def define_options
end

#runObject


20
21
22
# File 'lib/social_snippet/command_line/ssnip/main_command.rb', line 20

def run
  social_snippet.api.insert_snippet(input_stream.read)
end

#usageObject


7
8
9
10
11
12
13
14
15
# File 'lib/social_snippet/command_line/ssnip/main_command.rb', line 7

def usage
  <<EOF
Usage: ssnip [options]

Example:
$ cat target_file | ssnip > snipped_file

EOF
end