lib/jive/cli.rb in jive-0.4.4 vs lib/jive/cli.rb in jive-0.5.0
- old
+ new
@@ -1,7 +1,8 @@
# frozen_string_literal: true
+require "cli/ui"
require "pathname"
require "thor"
require "yaml"
require "jive"
@@ -50,10 +51,26 @@
host = options[:host]
Jive.shell.run_safely { Git.new(Jive.shell).clone(slug, host: host) }
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) }
end
@@ -72,14 +89,12 @@
Project
.new(Pathname.pwd)
.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
desc "setup", "provide instructions to integrate into shell"
def setup