Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't create merge request from shell #80

Closed
brauliobo opened this issue Sep 18, 2014 · 3 comments
Closed

Can't create merge request from shell #80

brauliobo opened this issue Sep 18, 2014 · 3 comments

Comments

@brauliobo
Copy link

gitlab> create_merge_request 'noosfero', 'Hide private profiles from blocks', :source_branch => 'blogoosfero258', :target_branch => 'master'
wrong number of arguments (12 for 2..3)
nil
@asedge
Copy link
Collaborator

asedge commented Oct 16, 2014

@brauliobo Improved arg parsing was merged a few days after you filed this issue. See this PR: #66. You will almost certainly want that fix, but that alone won't fix your problem.

You shouldn't use commas to separate arguments. Also, try double quoting arguments with spaces in them like this ":source_branch => blogoosfero258".

Sorry for the delay in getting back! I'm not a Collaborator on this project so I don't get notified of issues. Since I added the readline shell, I certainly would like to make sure any bugs with it are fixed.

@asedge
Copy link
Collaborator

asedge commented Nov 28, 2014

This was quite painful. The quote parsing was still a bit of a problem but works better now.

I had never did anything for the options hash. What I came up with was YAML syntax for passing options like this:

gitlab> create_merge_request 4 "This isn't dangerous!" '{source_branch: new_branch, target_branch: master}'
+-------------------+--------------------------+
| Gitlab.create_merge_request 4, This isn't dangerous!, {:source_branch=>"new_branch", :target_branch=>"master"} |
+-------------------+--------------------------+
| assignee          | null                     |
+-------------------+--------------------------+
| author            | Hash                     |
+-------------------+--------------------------+
| created_at        | 2014-11-28T22:57:46.168Z |
+-------------------+--------------------------+
| description       | null                     |
+-------------------+--------------------------+
| downvotes         | 0                        |
+-------------------+--------------------------+
| id                | 4                        |
+-------------------+--------------------------+
| iid               | 4                        |
+-------------------+--------------------------+
| labels            | []                       |
+-------------------+--------------------------+
| milestone         | null                     |
+-------------------+--------------------------+
| project_id        | 4                        |
+-------------------+--------------------------+
| source_branch     | new_branch               |
+-------------------+--------------------------+
| source_project_id | 4                        |
+-------------------+--------------------------+
| state             | opened                   |
+-------------------+--------------------------+
| target_branch     | master                   |
+-------------------+--------------------------+
| target_project_id | 4                        |
+-------------------+--------------------------+
| title             | This isn't dangerous!    |
+-------------------+--------------------------+
| updated_at        | 2014-11-28T22:57:46.168Z |
+-------------------+--------------------------+
| upvotes           | 0                        |
+-------------------+--------------------------+
gitlab>

Here's the code: https://github.com/asedge/gitlab/commit/65b7b53ffded594ab82af2993981371d1f94a798. I'm not sure I love the approach but it works.

@asedge
Copy link
Collaborator

asedge commented Dec 2, 2014

Code has been merged into the master branch to fix the options hash issue as well as improve the argument parsing (using Shellwords).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants