Class: Checkoff::QuickaddSubcommand

Inherits:
Object
  • Object
show all
Defined in:
lib/checkoff/cli.rb

Overview

CLI subcommand that creates a task

Instance Method Summary collapse

Constructor Details

#initialize(workspace_name, task_name, config: Checkoff::Internal::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config: config), tasks: Checkoff::Tasks.new(config: config)) ⇒ QuickaddSubcommand

Returns a new instance of QuickaddSubcommand.



203
204
205
206
207
208
209
210
211
# File 'lib/checkoff/cli.rb', line 203

def initialize(workspace_name, task_name,
               config: Checkoff::Internal::ConfigLoader.load(:asana),
               workspaces: Checkoff::Workspaces.new(config: config),
               tasks: Checkoff::Tasks.new(config: config))
  @workspace_name = workspace_name
  @task_name = task_name
  @workspaces = workspaces
  @tasks = tasks
end

Instance Method Details

#runObject



213
214
215
216
217
# File 'lib/checkoff/cli.rb', line 213

def run
  workspace = @workspaces.workspace_or_raise(workspace_name)
  @tasks.add_task(task_name,
                  workspace_gid: workspace.gid)
end