lib/ninny/commands/pull_request_merge.rb in ninny-0.1.15 vs lib/ninny/commands/pull_request_merge.rb in ninny-0.1.16
- old
+ new
@@ -20,17 +20,24 @@
self.pull_request_id = current.number if current
end
self.pull_request_id ||= select_pull_request
+ return nil if pull_request_id.nil?
+
check_out_branch
merge_pull_request
comment_about_merge
end
def select_pull_request
choices = Ninny.repo.open_pull_requests.map { |pr| { name: pr.title, value: pr.number } }
- prompt.select("Which #{Ninny.repo.pull_request_label}?", choices)
+
+ if choices.empty?
+ prompt.say "There don't seem to be any open merge requests."
+ else
+ prompt.select("Which #{Ninny.repo.pull_request_label}?", choices)
+ end
end
private :select_pull_request
# Public: Check out the branch
def check_out_branch