-
Notifications
You must be signed in to change notification settings - Fork 0
/
gh-pr-repl
executable file
·38 lines (31 loc) · 1.18 KB
/
gh-pr-repl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env ruby
# frozen_string_literal: true
require_relative 'lib/repl'
# Called only from the CLI
if __FILE__ == $PROGRAM_NAME
# Parsing the options
options = {}
OptionParser.new do |opts|
opts.banner = <<~ENDOFBANNER
Usage: gh-pr-repl [options] [reference ...]
If no reference is passed, `gh` will try to infer from the current context.
References can be of the following form:
- https://github.com/<owner>/<repo>/pull/<number>
- <owner>/<repo>/<branch>
- <branch> (<owner>/<repo> is fetched from the context)
- <query> (use the query with https://docs.github.com/en/rest/reference/search, <owner>/<repo> is fetched from the context)
ENDOFBANNER
opts.separator "\nOptions:"
opts.on('-sLINK', '--slack-link=LINK', 'Deep link for slack, ref https://api.slack.com/reference/deep-linking.')
opts.on('-a', '--all', 'Loop through all PRs, even the closed ones.')
opts.on('-cCOMMAND', '--command=COMMAND', 'Command to apply for all the PRs..')
end.parse!(into: options)
# Calling the REPL
REPL.new(
slack_link: options[:"slack-link"],
show_all: options[:all],
command: options[:command]
).main(
ARGV
)
end