Class: Afterlife::Clickup::Cli

Inherits:
Thor
  • Object
show all
Includes:
BaseCli
Defined in:
lib/afterlife/clickup/cli.rb

Constant Summary collapse

CLICKUP_STATUS_OPTIONS =
StatusPrecedenceChecker::STATUS_PRECEDENCE.map { |s| "'#{s}'" }.join(', ')

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseCli

#fatal!, #log_error, #log_info, #log_interrupted, #log_success, #sure?

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/afterlife/clickup/cli.rb', line 10

def self.exit_on_failure?
  true
end

Instance Method Details

#extract_ids(text = nil) ⇒ Object



17
18
19
20
21
# File 'lib/afterlife/clickup/cli.rb', line 17

def extract_ids(text = nil)
  text ||= $stdin.read
  ids = GetIdsFromText.call(text, options[:link])
  ids.each { |id| puts id }
end

#get_commits(from_revision, to_revision = 'HEAD') ⇒ Object



27
28
29
30
31
32
# File 'lib/afterlife/clickup/cli.rb', line 27

def get_commits(from_revision, to_revision = 'HEAD')
  messages = GetRangeCommits.call(from_revision, to_revision, short: options[:short])
  puts messages
rescue StandardError => e
  fatal!(e.message)
end

#update_status(target_status, *task_ids) ⇒ Object

rubocop:disable Metrics/AbcSize



46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/afterlife/clickup/cli.rb', line 46

def update_status(target_status, *task_ids) # rubocop:disable Metrics/AbcSize
  task_ids = $stdin.read.strip.split("\n") if task_ids.empty?

  UpdateTaskStatus.call(
    task_ids, target_status,
    force: options[:force],
    dry_run: options[:dry_run],
    cherry_pick: options[:cherry_pick],
    verbose: options[:verbose],
    commits: options[:commits],
  )
rescue StandardError => e
  fatal!(e.message)
end