hook create fails? #8

Closed
rcoup opened this Issue Apr 3, 2013 · 10 comments

Projects

None yet

2 participants

rcoup commented Apr 3, 2013

I'm all out of ideas...

$ gcli hook help create 
Usage:
  gcli hook create <user> <repo>

Options:
  -p, [--params=key:value]              # Request parameters e.i per_page:100
  -f, [--format=csv|json|pretty|table]  # Format of the output. Type table:h to display table horizontally.
                                        # Default: table

Description:
  Inputs

  name - Required string - the name of the service that is being called.

  config - Required hash - A Hash containing key/value pairs to provide settings for this hook.

  events - Optional array - Determines what events the hook is triggered for. Default: ["push"]

  active - Optional boolean - Determines whether the hook is actually triggered on pushes.


$ gcli hook create myorg myrepo --name=web --events=["status"] --config={"url":"http://example.com/path","content_type":"json"}
gcli create requires at least 2 arguments: "gcli hook create <user> <repo>".

$ gcli hook create myorg myrepo -p name:web -p events:["status"] -p config:{"url":"http://example.com/path","content_type":"json"}
gcli create requires at least 2 arguments: "gcli hook create <user> <repo>".

$ gcli hook create myorg myrepo --params=name:web --params=events:["status"] --params=config:{"url":"http://example.com/path","content_type":"json"}
Fatal error has occurred. 
Problem:
 Missing required parameters: config provided for this request.
Summary:
 Github gem checks the request parameters passed to ensure that github api is not hit unnecessairly and to fail fast.
Resolution:
 Required parameters are: name, config, make sure these are the ones you are using

$ gcli hook create myorg myrepo
Fatal error has occurred. 
Problem:
 Missing required parameters:  provided for this request.
Summary:
 Github gem checks the request parameters passed to ensure that github api is not hit unnecessairly and to fail fast.
Resolution:
 Required parameters are: name, config, make sure these are the ones you are using

It's not clear from the help/docs/etc whether --name=me or --params=name:me or -p name:me is the right way to specify parameters, let alone how to specify an array/hash as a parameter.

Owner

Hi Robert, thanks for using the library and reporting the issue. Sorry for the frustrating experience. I'm in the process of rewriting it and release updates frequently. I haven't looked into hook command yet but will jump on it this evening if you can wait.

rcoup commented Apr 4, 2013

No worries, just wasn't sure whether it works and I was missing something, or whether there was a bug! 😃

Owner

All hook commands should be fixed now, just released v0.5.7 🚢 . I've run your command on live repository with good result

gcli hook create <user> <repo> --name=web --events=status --config=url:"http://example.com/path"

Help should also be clearer, the array params are just strings delimited by space. Similarly, the hash config consists of key:value pairs separated by space.

I still expect to find some bugs as this library is going through quick development, however I'm testing it thoroughly to crash all bugs with my test detergent 😄

If you have any observations/suggestions on using this library please post them on this issue tracker and I will be more than happy to look into them. I particularly appreciate usability/interface comments.

rcoup commented Apr 14, 2013
gcli hook create ... "--events=status push" ...

Didn't seem to work (just created as events:[]), but the other parameters went through as expected.

Owner

I'm running the following:
gcli hook create user repo --name=web --active --events=push pull_request --config=url:"http://example.com/webkook" content_type:json
as an example and events are created fine. I'm wondering why are you putting --events param in quotes? It may well be that it is skipped when parsing the parameters list.

rcoup commented Apr 14, 2013

Because I wanted to register a hook for both status & push events.

On Monday, 15 April 2013, Piotr Murach wrote:

I'm running the following:
gcli hook create user repo --name=web --active --events=push pull_request
--config=url:"http://example.com/webkook" content_type:json

as an example and events are created fine. I'm wondering why are you
putting --events param in quotes? It may well be that it is skipped when
parsing the parameters list.


Reply to this email directly or view it on GitHubhttps://github.com/peter-murach/github_cli/issues/8#issuecomment-16352626
.

Owner

You can supply array elements separated by space so in your case --events=status push without any quotes or delimiters.

rcoup commented Apr 14, 2013

Really? that's some crazy arg-parsing behaviour! Thanks, will give it a go
later today.

On Mon, Apr 15, 2013 at 7:16 AM, Piotr Murach notifications@github.comwrote:

You can supply array elements separated by space so in your case --events=status
push without any quotes or delimiters.


Reply to this email directly or view it on GitHubhttps://github.com/peter-murach/github_cli/issues/8#issuecomment-16357396
.

Owner

Any luck Robert?

Owner

Hi Robert, I am gonna close this issue as gcli hook create works for me and is fully tested. I have also added an arguments section to the docs based on your example.

@piotrmurach piotrmurach closed this Jun 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment