summaryrefslogtreecommitdiff
path: root/lib/jive/cli.rb
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-02-10 14:47:47 -0700
committermo khan <mo@mokhan.ca>2025-02-10 14:47:47 -0700
commitb2bf2e20fe0bd813e17e311fe1df67483f4b192b (patch)
tree041455ae7fc3d09482dee7b6a3b0de12bdff31e1 /lib/jive/cli.rb
parent5f6131b49c3d559ea717e401accd15f8c2193e2f (diff)
Merge code from gem because the git history is lostHEADmain
Diffstat (limited to 'lib/jive/cli.rb')
-rw-r--r--lib/jive/cli.rb25
1 files changed, 20 insertions, 5 deletions
diff --git a/lib/jive/cli.rb b/lib/jive/cli.rb
index 0a711ed..bce4ddc 100644
--- a/lib/jive/cli.rb
+++ b/lib/jive/cli.rb
@@ -1,5 +1,6 @@
# frozen_string_literal: true
+require "cli/ui"
require "pathname"
require "thor"
require "yaml"
@@ -52,6 +53,22 @@ module Jive
end
end)
+ desc "issue SUBCOMMAND ...ARGS", "issue things"
+ subcommand "issue", (Class.new(Thor) do
+ desc "list <type>", "List the issues"
+ def list(type = Issue.what_type?)
+ issues = Issue.for(type)
+ issue = Jive.prompt?(issues, display: ->(x) { x.file_name })
+ issue.edit
+ end
+
+ desc "create <type>", "Create a new issue"
+ def create(type = Issue.what_type?)
+ issue = Issue.create!(name: ask("Name:"), type: type)
+ issue.edit
+ end
+ end)
+
desc "cd <org>/<project>", "cd to ~/src/github.com/<org>/<project>"
def cd(slug)
Jive.shell.run_safely { Git.new(Jive.shell).cd(slug) }
@@ -74,11 +91,9 @@ module Jive
.bootstrap(Jive.shell)
end
- desc "pr URL", "pull request"
- def pr(url = Repo.current.canonical_url)
- return say("Invalid url") && exit(1) unless url
-
- pr = PullRequest.new(url)
+ desc "pr", "pull request"
+ def pr
+ pr = PullRequest.new(repo: Repo.current)
pr.edit(ENV["EDITOR"])
end