Code Monkey home page Code Monkey logo

ghi's Issues

Open All in Browser

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

Interactive mode

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

Add ability to see who claimed an issue when viewing one through "ghi <#>"

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 broken: issue.rb:6:in `initialize': undefined method `[]'

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

http://pastie.org/780719

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: {}

Doesn't work on Windows?

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

Add ability to list in reverse order

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?

Accept commands (in addition to flags)

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.

git ANSI colors?

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

Ruby 1.9 error?

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:inurlencode'
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:inmap'
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:inblock 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:inmap'
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:inpost_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:incomment'
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:inrun!'
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

'

Save issue/comment/milestone bodies in .git if in repo dir

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.

Do not cache messages with the -r flag

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).

New Dev Environment, "GitHub hiccuped"

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]

Validate usernames and tokens

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.

Show patch

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.

"ghi assign <issue>" doesn't work

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.

Can't reference github token in another file in .gitconfig

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

ghi: not a GitHub repo

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.

ghi edit

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

Probs with new command parser?

 $  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]

Verbose listing of issue should include comments

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)

I can't see anything I type after I run ghi.

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.

Validation Failed

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.

Listing all open issues, unassigned

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>'
~|⇒ 

Issue, NoMethod []

/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?

ability to add priority and severity of issues

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.

Should consume all arguments

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).

ghi open issues: undefined method `link`

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.