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: config), sections: Checkoff::Sections.new(config: config, projects: projects), tasks: Checkoff::Tasks.new(config: config, sections: sections), stderr: $stderr) ⇒ ViewSubcommand

Returns a new instance of ViewSubcommand.



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/checkoff/cli.rb', line 123

def initialize(workspace_name, project_name, section_name,
               task_name,
               config: Checkoff::Internal::ConfigLoader.load(:asana),
               projects: Checkoff::Projects.new(config: config),
               sections: Checkoff::Sections.new(config: config,
                                                projects: projects),
               tasks: Checkoff::Tasks.new(config: config,
                                          sections: 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

#runObject



141
142
143
144
145
146
147
148
149
# File 'lib/checkoff/cli.rb', line 141

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