Class: Toodledo::CommandLine::AddFolderCommand
- Inherits:
-
BaseCommand
- Object
- CmdParse::Command
- BaseCommand
- Toodledo::CommandLine::AddFolderCommand
- Includes:
- ParserHelper
- Defined in:
- lib/toodledo/command_line/add_command.rb
Overview
Adds a folder from the command
Constant Summary
Constants included from ParserHelper
ParserHelper::CONTEXT_REGEXP, ParserHelper::FOLDER_REGEXP, ParserHelper::GOAL_REGEXP, ParserHelper::LEVEL_REGEXP, ParserHelper::PRIORITY_REGEXP, ParserHelper::REGEXP_LIST
Instance Method Summary collapse
- #execute(args) ⇒ Object
-
#initialize(client) ⇒ AddFolderCommand
constructor
A new instance of AddFolderCommand.
Methods included from ParserHelper
#parse_context, #parse_folder, #parse_goal, #parse_level, #parse_priority, #parse_remainder, #strip_brackets
Methods inherited from BaseCommand
Constructor Details
#initialize(client) ⇒ AddFolderCommand
Returns a new instance of AddFolderCommand.
32 33 34 35 36 |
# File 'lib/toodledo/command_line/add_command.rb', line 32 def initialize(client) super(client, 'folder', false) self.short_desc = "Add a folder" self.description = "Adds a folder to Toodledo" end |
Instance Method Details
#execute(args) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/toodledo/command_line/add_command.rb', line 38 def execute(args) return if (args == nil) Toodledo.begin(client.logger) do |session| line = args.join(' ') client.add_folder(session, line) end return 0 rescue ItemNotFoundError => e puts e. return -1 end |