Class: Toodledo::CommandLine::AddContextCommand
- Inherits:
-
BaseCommand
- Object
- CmdParse::Command
- BaseCommand
- Toodledo::CommandLine::AddContextCommand
- Defined in:
- lib/toodledo/command_line/add_command.rb
Overview
Adds a context from the command line
Instance Method Summary collapse
- #execute(args) ⇒ Object
-
#initialize(client) ⇒ AddContextCommand
constructor
A new instance of AddContextCommand.
Methods inherited from BaseCommand
Constructor Details
#initialize(client) ⇒ AddContextCommand
Returns a new instance of AddContextCommand.
84 85 86 87 88 |
# File 'lib/toodledo/command_line/add_command.rb', line 84 def initialize(client) super(client, 'context', false) self.short_desc = "Adds context" self.description = "Adds a context to Toodledo" end |
Instance Method Details
#execute(args) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/toodledo/command_line/add_command.rb', line 90 def execute(args) return if (args == nil) Toodledo.begin(client.logger) do |session| line = args.join(' ') client.add_context(session, line) end return 0 rescue ItemNotFoundError => e puts e. return -1 end |