stephencelis / ghi Goto Github PK
View Code? Open in Web Editor NEWGitHub Issues on the command line. Use your $EDITOR, not your browser.
License: Other
GitHub Issues on the command line. Use your $EDITOR, not your browser.
License: Other
Currently, 80+ character titles can hit newlines on list actions.
I would like to be able to read issue comments.
I've got this in my bash profile to allow me to open up all issues in my browser (sometimes quite a length operation, depending on how many there are). I find it very useful for those times that you want to audit the issues and update yourself with everything to ensure you're update-to-date.
I submit it to you for your consideration.
function ghi-w() {
ghi $* | awk '{ print substr($1,1,length($1)-1), "\n" }' | cat | xargs -n 1 ghi -w $*
}
Example usage: ghi-w -u icio
An interactive mode would be valuable. While commands are relatively short for local directories that are repositories, browsing remote repositories can be cumbersome with the -r flag requirement
Example:
number: 185
state: open
title: Add a Service Opportunities View to Upcoming Events on Community Home
user: csiegfried
votes: 0
created at: Thu Oct 13 17:59:06 -0500 2011
updated at: Mon Oct 17 09:48:37 -0500 2011
Perhaps:
number: 185
state: open
title: Add a Service Opportunities View to Upcoming Events on Community Home
user: csiegfried
claimed by: clifton
votes: 0
created at: Thu Oct 13 17:59:06 -0500 2011
updated at: Mon Oct 17 09:48:37 -0500 2011
ghi completely broken on my system.
I'm running the latest snow leopard: 10.6.2
Ruby Version: ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
Steps to reproduce:
$ git clone [email protected]:nharbour/git-deploy.git
$ cd git-deploy
$ ghi
Gives the following error:
# Open issues on nharbour/git-deploy
/Library/Ruby/Gems/1.8/gems/ghi-0.2.4/lib/ghi/issue.rb:6:in `initialize': undefined method `[]' for #<YAML::Object:0x10171de30> (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/ghi-0.2.4/lib/ghi/api.rb:28:in `new'
from /Library/Ruby/Gems/1.8/gems/ghi-0.2.4/lib/ghi/api.rb:28:in `list'
from /Library/Ruby/Gems/1.8/gems/ghi-0.2.4/lib/ghi/api.rb:28:in `map'
from /Library/Ruby/Gems/1.8/gems/ghi-0.2.4/lib/ghi/api.rb:28:in `list'
from /Library/Ruby/Gems/1.8/gems/ghi-0.2.4/lib/ghi/cli.rb:460:in `list'
from /Library/Ruby/Gems/1.8/gems/ghi-0.2.4/lib/ghi/cli.rb:248:in `run!'
from /Library/Ruby/Gems/1.8/gems/ghi-0.2.4/lib/ghi/cli.rb:239:in `parse!'
from /Library/Ruby/Gems/1.8/gems/ghi-0.2.4/bin/ghi:6
from /usr/bin/ghi:19:in `load'
from /usr/bin/ghi:19
API works fine through CURL:
curl http://github.com/api/v2/yaml/issues/list/nharbour/git-deploy/open
---
issues:
- !ruby/object:Issue
attributes:
votes: "0"
number: "1"
position: "1"
issue_comments_count: "0"
created_at: 2010-01-16 04:20:11
title: my title
body: test
updated_at: 2010-01-16 04:20:11
id: "113989"
user_id: "38154"
closed_at:
repository_id: "84647"
state: open
attributes_cache: {}
- !ruby/object:Issue
attributes:
votes: "0"
number: "2"
position: "2"
issue_comments_count: "0"
created_at: 2010-01-16 04:29:38
title: second issue
body: boo
updated_at: 2010-01-16 04:29:38
id: "113995"
user_id: "38154"
closed_at:
repository_id: "84647"
state: open
attributes_cache: {}
Can't Ctrl-C, Ctrl-D or anything. Completely unresponsive. I wish it would fail with some error message instead...
Mac OS X 10.7.3
Terminal v2.2.2
MacBook Pro (Mid-2009)
You should be able to pass --claim alongside open, reopen, comment, and perhaps others.
Hey, sorry if I got that wrong, but the command line client doesn't seem to work under Windows (XP).
When i enter "ghi" it just responds with "The filename, directory name, or volume label syntax is incorrect."
I guess it's a different way you include executables within your gem?
Anyways, great gem otherwise! Cheers, Dennis
Not sure if others feel the same way, but I'd like an argument to be able to view the issues from most recent to least recent (now they are from least recent to most recent).
Thoughts?
As the API expands, flags may become more and more cumbersome. Splitting functionality into commands would help us prepare for this, and provide an additional syntax to those who prefer it. E.g.,
% ghi list
Commands can be split into the higher level API actions.
Inner underscores should not ANSI-underline.
Hey Stephen,
I'm having trouble understanding how to use the ANSI colors with ghi. My prompt is using colors, and I set it up so git also uses colors (in status
, log
, etc...).
Do you know of a resource I could check out to get these ANSI colors set up? I'd really love to have a colorful ghi CLI.
Thanks for making this awesome :D
I can list issues just fine, but when I try to comment on an issue, I receive this error. From the trace, I'm thinking it's a ruby 1.9 error and not specific to ghi. Am I right?
/usr/local/lib/ruby19/1.9.1/net/http.rb:1529:in dup': can't dup Symbol (TypeError) from /usr/local/lib/ruby19/1.9.1/net/http.rb:1529:in
urlencode'
from /usr/local/lib/ruby19/1.9.1/net/http.rb:1524:in block in encode_kvpair' from /usr/local/lib/ruby19/1.9.1/net/http.rb:1524:in
map'
from /usr/local/lib/ruby19/1.9.1/net/http.rb:1524:in encode_kvpair' from /usr/local/lib/ruby19/1.9.1/net/http.rb:1517:in
block in set_form_data'
from /usr/local/lib/ruby19/1.9.1/net/http.rb:1517:in each' from /usr/local/lib/ruby19/1.9.1/net/http.rb:1517:in
map'
from /usr/local/lib/ruby19/1.9.1/net/http.rb:1517:in set_form_data' from /usr/local/lib/ruby19/1.9.1/net/http.rb:415:in
post_form'
from /usr/local/lib/ruby19/gems/1.9.1/gems/ghi-0.2.1/lib/ghi/api.rb:79:in post' from /usr/local/lib/ruby19/gems/1.9.1/gems/ghi-0.2.1/lib/ghi/api.rb:61:in
comment'
from /usr/local/lib/ruby19/gems/1.9.1/gems/ghi-0.2.1/lib/ghi/cli.rb:531:in comment' from /usr/local/lib/ruby19/gems/1.9.1/gems/ghi-0.2.1/lib/ghi/cli.rb:250:in
run!'
from /usr/local/lib/ruby19/gems/1.9.1/gems/ghi-0.2.1/lib/ghi/cli.rb:235:in parse!' from /usr/local/lib/ruby19/gems/1.9.1/gems/ghi-0.2.1/bin/ghi:6:in
<top (required)>'
from /usr/local/bin/ghi:19:in load' from /usr/local/bin/ghi:19:in
As long as we're in a repository, we should save GHI_ISSUE, GHI_COMMENT, and GHI_MILESTONE just in case validation fails so we don't lose our work.
In lieu of a .git directory, we could still save in tmp without using a Tempfile.
We should at the very least implement spec coverage for the CLI layer.
If you access a repository using the -r flag, and the request fails, the message is still cached if a .git directory is within scope. We should fall back to Tempfile in these cases, alternatively spitting the message back to stdout, or prompting for a path where the tempfile could be permanently saved. We could also provide a URL where the user could try again (if there are API issues).
Hey, started with a new computer today and moved all of my dotfiles over. I went to use ghi for a project I've been using it for for a while but to no avail. I got this:
aadc-rwmp:CALS-Core pjm336$ ghi list
# Open issues on CALSCommunications/CALS-Core
ghi: GitHub hiccuped on your request (CALSCommunications/CALS-Core)
My .gitconfig
contains the appropriate info:
[github]
user = parkr
token = [REDACTED]
We should validate with an innocuous API hit, re-requesting the username if it does not exist, or re-requesting the token if the API hit fails authentication.
I would like to be able to something like ghi show --patch 200 | git am -3
.
Could you add -p, and --patch
to to the show
command? You will have to suffix the issue URL with .patch
to get it. It will only work on pull requests.
This is related to #47.
When trying to assign a bug to a user no query gets executed.
I've fixed this by moving the end
in the execute
method of the Edit
class up 5 lines. This way the patch query gets executed whether or not the title of the issue was modified.
It needs to be set on some constrasting colors, because on my setup the labelnames aren't readable.
We should be able to label issues from the command line.
; lines starting with '#' (like these) will be ignored, and empty messages will
; not be submitted. Issues are formatted with GitHub Flavored Markdown (GFM):
;
; http://github.github.com/github-flavored-markdown
;
; On stephencelis/ghi
Looks like some responses are simply returning false where they should be hashes. Not sure if this is a shift in the underlying Github API or what. I'm using 0.2.5 of ghi on 1.8.7 on natty.
$ ghi
# Open issues on technomancy/swank-clojure
/var/lib/gems/1.8/gems/ghi-0.2.5/lib/ghi/api.rb:82:in `get': undefined method `[]' for false:FalseClass (NoMethodError)
from /var/lib/gems/1.8/gems/ghi-0.2.5/lib/ghi/api.rb:30:in `list'
from /var/lib/gems/1.8/gems/ghi-0.2.5/lib/ghi/cli.rb:465:in `list'
from /var/lib/gems/1.8/gems/ghi-0.2.5/lib/ghi/cli.rb:249:in `run!'
from /var/lib/gems/1.8/gems/ghi-0.2.5/lib/ghi/cli.rb:240:in `parse!'
from /var/lib/gems/1.8/gems/ghi-0.2.5/bin/ghi:6
from /var/lib/gems/1.8/bin/ghi:19:in `load'
from /var/lib/gems/1.8/bin/ghi:19
I have two repos where I get this error message. One is brand new, one is older with only a gh-pages branch. Both are private. Let me know if I can help you troubleshoot.
Isn't it supposed to auto-detect the head branch? I have to specifically declare: -h user:branch
for it to change to a pull request
Just kidding. Didn't know gH had this tool. Neato.
There should be an option to leave a comment on an issue when closing or reopening.
ghi -o "My New Case" -m "Milestone2"
Would be nice.
-d
Running with --ssl causes an exception since use_ssl= doesn't exist until you require "net/https".
$ ghi -l
more: unknown option "-E"
usage: more [-dflpcsu] [+linenum | +/pattern] name1 name2 ...
/usr/lib/ruby/gems/1.8/gems/stephencelis-ghi-0.1.2/lib/ghi/cli.rb:164:in `write': Broken pipe (Errno::EPIPE)
from /usr/lib/ruby/gems/1.8/gems/stephencelis-ghi-0.1.2/lib/ghi/cli.rb:164:in `puts'
from /usr/lib/ruby/gems/1.8/gems/stephencelis-ghi-0.1.2/lib/ghi/cli.rb:164:in `puts'
from /usr/lib/ruby/gems/1.8/gems/stephencelis-ghi-0.1.2/lib/ghi/cli.rb:429:in `list'
from /usr/lib/ruby/gems/1.8/gems/stephencelis-ghi-0.1.2/lib/ghi/cli.rb:226:in `run!'
from /usr/lib/ruby/gems/1.8/gems/stephencelis-ghi-0.1.2/lib/ghi/cli.rb:217:in `parse!'
from /usr/lib/ruby/gems/1.8/gems/stephencelis-ghi-0.1.2/bin/ghi:5
from /usr/bin/ghi:19:in `load'
from /usr/bin/ghi:19
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
The comments of issues are also exposed, for taking an issue offline to work on it'd be nice to have them for the full issue context.
curl http://github.com/api/v2/json/issues/comments/stephencelis/ghi/2
Probably only want to do if issues has comments > 0 but this is a quick POC
diff --git a/lib/ghi/api.rb b/lib/ghi/api.rb
index ade3da5..6a3bed4 100644
--- a/lib/ghi/api.rb
+++ b/lib/ghi/api.rb
@@ -30,6 +30,10 @@ class GHI::API
get(:list, state)["issues"].map { |attrs| GHI::Issue.new(attrs) }
end
+ def comments(number)
+ get(:comments, number)["comments"]
+ end
+
def show(number)
GHI::Issue.new get(:show, number)["issue"]
end
diff --git a/lib/ghi/cli.rb b/lib/ghi/cli.rb
index 6cec7ec..f09910e 100644
--- a/lib/ghi/cli.rb
+++ b/lib/ghi/cli.rb
@@ -129,6 +129,13 @@ module GHI::CLI #:nodoc:
return l unless verbose
l << ""
l += indent(issue.body)[0..-2]
+ comments = api.comments(issue.number)
+ comments.each do |c|
+ l << " user: #{c['user']}"
+ l << " commented at: #{c['created_at']}"
+ l << " #{c['body']}"
+ end
+ return l
end
def action_format(value = nil)
The commands still work. I can type "ls" and get output, but when I type something I just don't see it. This happens consistently right after I run ghi, and only if I don't have the username/token set.
I name my GitHub remotes “github,” not “origin.”
I should be able to configure GHI (perhaps via git config --global github.remote
?) to work with whatever remote name I want.
Presently, it outputs:
But, it should be:
The first one should redirect to the second in the case of a pull request.
You should also have an option to browse the URL.
I've tried email:password, username:password nothing works. What's going on? Is it validating my github account? Because it's the right credentials.
It doesn't seem to be possible to list all issues in a repo. Ideally I'd like to see all issues regardless of assignment.
~|⇒ ghi list -u -- jmazzi/crypt_keeper
/home/justin/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/ghi-0.9.0.20120731/lib/ghi/commands/list.rb:71:in `block (2 levels) in options': undefined method `sub' for nil:NilClass (NoMethodError)
from /home/justin/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/optparse.rb:1391:in `call'
from /home/justin/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/optparse.rb:1391:in `block in parse_in_order'
from /home/justin/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/optparse.rb:1347:in `catch'
from /home/justin/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/optparse.rb:1347:in `parse_in_order'
from /home/justin/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/optparse.rb:1341:in `order!'
from /home/justin/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/optparse.rb:1432:in `permute!'
from /home/justin/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/optparse.rb:1453:in `parse!'
from /home/justin/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/ghi-0.9.0.20120731/lib/ghi/commands/list.rb:92:in `execute'
from /home/justin/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/ghi-0.9.0.20120731/lib/ghi/commands/command.rb:17:in `execute'
from /home/justin/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/ghi-0.9.0.20120731/lib/ghi.rb:76:in `execute'
from /home/justin/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/ghi-0.9.0.20120731/bin/ghi:4:in `<top (required)>'
from /home/justin/.rbenv/versions/1.9.3-p194/bin/ghi:23:in `load'
from /home/justin/.rbenv/versions/1.9.3-p194/bin/ghi:23:in `<main>'
~|⇒
Tempfile isn't playing very nicely with system calls.
/usr/local/bin/ghi:3664:in `execute`: undefined method `[]` for nil:NilClass (NoMethodError)
from /usr/local/bin/ghi:2483:in `execute`
from /usr/local/bin/ghi:70:in `execute`
from /usr/local/bin/ghi:3725
when trying to do ghi open
I think it was due to me not being un-authed when I re-downloaded it?
Not sure if github itself supports capability to assign priority and severity of an issue and wondering if ghi can extend the same to cli.
I am also wondering how to increase the ghi output column size. right now, I have a putty that shows 132 columns, but ghi list output is cut off after 80 columns.
I would like to write
ghi -o Should consume all arguments
Right now the line throws away everything after "Should".
Obviously this is not a bug. I can always write
ghi -o "Should consume all arguments"
but eating all remaining args and treating them as one would be nice (and many other tools do this).
when using ghi open -m "Title Here" -L label-here
causes this error:
/usr/local/bin/ghi:3648:in `execute': undefined method `unlink' for nil:NilClass (NoMethodError)
from /usr/local/bin/ghi:2484:in `execute'
from /usr/local/bin/ghi:70:in `execute'
from /usr/local/bin/ghi:3717
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.