Class: GithubIssueSync::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Let Thor’s required-option and unknown-command errors exit non-zero.

Returns:

  • (Boolean)


9
10
11
# File 'lib/github_issue_sync/cli.rb', line 9

def self.exit_on_failure?
  true
end

Instance Method Details

#exportObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/github_issue_sync/cli.rb', line 40

def export
  token = require_token!
  exporter = IssueExporter.new(
    repo:   options[:repo],
    token:  token,
    labels: options[:labels],
    state:  options[:state]
  )

  if (path = options[:output])
    exporter.call(output_path: path, io: $stderr)
  else
    exporter.call(io: $stdout)
  end
end

#syncObject



69
70
71
72
73
74
# File 'lib/github_issue_sync/cli.rb', line 69

def sync
  token = require_token!
  syncer = IssueSyncer.new(repo: options[:repo], token: token)
  result = syncer.call(csv_path: options[:input])
  $stderr.puts "Done. Updated: #{result[:updated]}, Created: #{result[:created]}"
end

#versionObject



17
18
19
# File 'lib/github_issue_sync/cli.rb', line 17

def version
  puts GithubIssueSync::VERSION
end