Class: Checkoff::ViewSubcommand

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

Overview

CLI subcommand that shows tasks in JSON form

Instance Method Summary collapse

Constructor Details

#initialize(workspace_name, project_name, section_name, task_name, config: Checkoff::Internal::ConfigLoader.load(:asana), projects: Checkoff::Projects.new(config:), sections: Checkoff::Sections.new(config:, projects:), tasks: Checkoff::Tasks.new(config:, sections:), stderr: $stderr) ⇒ ViewSubcommand

Returns a new instance of ViewSubcommand.

Parameters:

  • workspace_name (String)
  • project_name (String, Symbol)
  • section_name (String, Symbol, nil)
  • task_name (String, Symbol, nil)
  • config (Checkoff::Internal::EnvFallbackConfigLoader, Hash) (defaults to: Checkoff::Internal::ConfigLoader.load(:asana))
  • projects (Checkoff::Projects) (defaults to: Checkoff::Projects.new(config:))
  • sections (Checkoff::Sections) (defaults to: Checkoff::Sections.new(config:, projects:))
  • tasks (Checkoff::Tasks) (defaults to: Checkoff::Tasks.new(config:, sections:))
  • stderr (IO) (defaults to: $stderr)


168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/checkoff/cli.rb', line 168

def initialize(workspace_name, project_name, section_name,
               task_name,
               config: Checkoff::Internal::ConfigLoader.load(:asana),
               projects: Checkoff::Projects.new(config:),
               sections: Checkoff::Sections.new(config:,
                                                projects:),
               tasks: Checkoff::Tasks.new(config:,
                                          sections:),
               stderr: $stderr)
  @workspace_name = workspace_name
  @stderr = stderr
  validate_and_assign_project_name(project_name)
  @section_name = section_name
  @task_name = task_name
  @sections = sections
  @tasks = tasks
end

Instance Method Details

#runvoid

This method returns an undefined value.



187
188
189
190
191
192
193
194
195
# File 'lib/checkoff/cli.rb', line 187

def run
  if section_name.nil?
    run_on_project(workspace_name, project_name)
  elsif task_name.nil?
    run_on_section(workspace_name, project_name, section_name)
  else
    run_on_task(workspace_name, project_name, section_name, task_name)
  end
end