Class: Abt::Providers::Asana::Commands::Pick

Inherits:
BaseCommand show all
Defined in:
lib/abt/providers/asana/commands/pick.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#config, #path

Attributes inherited from BaseCommand

#ari, #cli, #flags

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseCommand

#initialize

Methods inherited from BaseCommand

#initialize

Constructor Details

This class inherits a constructor from Abt::Providers::Asana::BaseCommand

Class Method Details

.descriptionObject



12
13
14
# File 'lib/abt/providers/asana/commands/pick.rb', line 12

def self.description
  "Pick a task and - unless told not to - make it current"
end

.flagsObject



16
17
18
19
20
21
# File 'lib/abt/providers/asana/commands/pick.rb', line 16

def self.flags
  [
    ["-d", "--dry-run", "Keep existing configuration"],
    ["-c", "--clean", "Don't reuse project configuration"]
  ]
end

.usageObject



8
9
10
# File 'lib/abt/providers/asana/commands/pick.rb', line 8

def self.usage
  "abt pick asana[:<project-gid>]"
end

Instance Method Details

#performObject



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/abt/providers/asana/commands/pick.rb', line 23

def perform
  pick!

  print_task(project, task)

  return if flags[:"dry-run"]

  if config.local_available?
    config.path = path
  else
    warn("No local configuration to update - will function as dry run")
  end
end