Class: GithubCommenter::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.github_pr_optionsObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/github_commenter/cli.rb', line 13

def github_pr_options
  option :from_env, enum: %w[ circleci ], description: "complete things from ENV variables of CI. override github,repo,pr,after,until"

  # github things
  option :github, description: "github API entry point (default: https://api.github.com/v3)"
  option :repo,   description: "respoitory of github e.g. okitan/github_commenter"
  option :pr, type: :numeric, description: "number of PR"

  option :github_access_token, required: true, default: ENV["GITHUB_ACCESS_TOKEN"]

  # comments
  option :after, description: "post comment when commits of inserting this line after this hash exist"
  option :until, description: "post comment when commits of inserting this line exists"
end

Instance Method Details

#prObject



39
40
41
42
43
# File 'lib/github_commenter/cli.rb', line 39

def pr
  @options, comments = parse_options

  post_pr_comments(filter_comments(comments, after: @options["after"], _until: @options["before"]))
end