Class: Toodledo::CommandLine::StdinCommand
- Inherits:
-
BaseCommand
- Object
- CmdParse::Command
- BaseCommand
- Toodledo::CommandLine::StdinCommand
- Defined in:
- lib/toodledo/command_line/stdin_command.rb
Overview
Runs the stdin client.
Instance Method Summary collapse
- #execute(args) ⇒ Object
-
#initialize(client) ⇒ StdinCommand
constructor
A new instance of StdinCommand.
Methods inherited from BaseCommand
Constructor Details
#initialize(client) ⇒ StdinCommand
Returns a new instance of StdinCommand.
10 11 12 13 14 |
# File 'lib/toodledo/command_line/stdin_command.rb', line 10 def initialize(client) super(client, 'stdin', false) self.short_desc = "Takes standard input" self.description = "Useful for pipes and redirected files" end |
Instance Method Details
#execute(args) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/toodledo/command_line/stdin_command.rb', line 16 def execute(args) Toodledo.begin(client.logger) do |session| $stdin.each do |line| line.strip! if (line == nil || line.empty?) return 0 end client.execute_command(session, line) end end end |