drewblessing / gitlab-cli Goto Github PK
View Code? Open in Web Editor NEWGitLab Command Line Tool - Interact with your GitLab server via the command line to manage snippets, projects and more.
License: MIT License
GitLab Command Line Tool - Interact with your GitLab server via the command line to manage snippets, projects and more.
License: MIT License
Removed a line in the snippet_delete method.
Both of you are using thor and rest client
https://github.com/drewblessing/gitlab-cli does listing things, snippet creation
https://github.com/georgecodes/glub adds project creation
Maybe you guys want to combine efforts?
It's unacceptable to exit after an error. This causes all sorts of issues for people using this as a library. Instead, rescue exceptions in the CLI command layer and handle appropriately.
See highline or look at Thor shell options
All should have usage examples.
In bin/subcommand/snippet.rb I use snippet.inspect. That was necessary before I started using Shellwords.escape in there. Now it adds unnecessary double quotes at the beginning and end of all snippets. Removing it tested fine.
Test to see what error message is given if a user is not authorized for a particular action.
Utilize Thor actions like shell output.
When running GitLab, I see this: (I've obfuscated my project names to protect the innocent
$ ./bin/gitlab projects
1: lnubb_gi
2: zvtengvba
3: pbeqbin_erzbgr
4: rfca_pbeqbin_naqebvq
5: hfrefnhehf
7: encgbe_ncv_grfgre
8: r3_mrvgren_vbf
9: urezrfnhehf
10: r3_mrvgren_qrzb_vbf
11: raunaprzrag_eraqrere
13: r3mrvgren_naqebvq
14: r3wf
16: r3nhqvoyrzntvp_naqebvq
17: erfcbafr_ncv_grfgre
18: urezrfnhehf_ncv_grfgre
19: rfn_grfg_unearff_naqebvq
21: rfn_grfg_unearff_vbf
22: erfcbafnqnpgly
23: r3_nhqvoyr_zntvp_vbf
24: tyrr_fgnaqnybar_naqebvq
I have access to 80 projects in GitLab, however. But I don't think there's any way to paginate.
The GitLab API by default only returns 20 objects at a time: https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/README.md#pagination
Allow user to configure output levels. Levels could be:
I'd like to share my setting across folders. Maybe a file in $HOME folder is a much better place to hold it.
Or, we can consider to create custom config in .gitconfig, since every gitlab user is a git User.
BTW, I had a set of scripts on GitLab, maybe I can create several pull requests.
Currently, if the Gitlab instances specified in the config file is not accessible the user gets a nasty trace:
gitlab-cli/lib/gitlab/util.rb:12:in `projects': undefined method `response' for #<SocketError:0x10d679658> (NoMethodError)
from /Users/drewb/development/gitlab-cli/bin/gitlab:15:in `projects'
from /Library/Ruby/Gems/1.8/gems/thor-0.17.0/lib/thor/task.rb:27:in `__send__'
from /Library/Ruby/Gems/1.8/gems/thor-0.17.0/lib/thor/task.rb:27:in `run'
from /Library/Ruby/Gems/1.8/gems/thor-0.17.0/lib/thor/invocation.rb:120:in `invoke_task'
from /Library/Ruby/Gems/1.8/gems/thor-0.17.0/lib/thor.rb:344:in `dispatch'
from /Library/Ruby/Gems/1.8/gems/thor-0.17.0/lib/thor/base.rb:434:in `start'
from /Users/drewb/development/gitlab-cli/bin/gitlab:49
It occurred to me that using ~/.gitlab.yml really wasn't the best idea. It makes more sense in my mind to use something more descriptive.
Improve the examples in the README file. Include output examples, too.
Break util class out into small focused util classes.
gitlab project info gitlab_demo
/Users/jian/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/gitlab_cli-2.0.0/lib/gitlab_cli/util.rb:14:in get_project_id': undefined method
projects' for GitlabCli::Util:Module (NoMethodError)
from /Users/jian/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/gitlab_cli-2.0.0/lib/gitlab_cli/util/project.rb:6:in get' from /Users/jian/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/gitlab_cli-2.0.0/lib/gitlab_cli/command/project.rb:15:in
info'
from /Users/jian/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in run' from /Users/jian/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:in
invoke_command'
from /Users/jian/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in dispatch' from /Users/jian/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:109:in
invoke'
from /Users/jian/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:232:in block in subcommand' from /Users/jian/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in
run'
from /Users/jian/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:in invoke_command' from /Users/jian/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in
dispatch'
from /Users/jian/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:in start' from /Users/jian/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/gitlab_cli-2.0.0/bin/gitlab:4:in
<top (required)>'
from /Users/jian/.rbenv/versions/1.9.3-p327-perf/bin/gitlab:23:in load' from /Users/jian/.rbenv/versions/1.9.3-p327-perf/bin/gitlab:23:in
The snippet/project subcommands output incorrect usage information:
"gitlab edit [PROJECT] [SNIPPET_ID]" instead of "gitlab snippet edit [PROJECT] [SNIPPET_ID]".
Per FFForever, it would be nice to have the ability to create a new project and import from a public repo like you can in the UI.
configuration should default to false
Test across multiple OS's mostly to test gem dependencies.
Support the group API
This will make it usable by scripts.
Hi
Thanks for helping me. I am try to setup a new CI instance for my projects. I cloned the code and done all my setup. Whenever i try to login it says invalid credentials. Upon debugging I got following information:
#<HTTParty::Response:0x10 parsed_response=nil, @response=#<Net::HTTPMethodNotAllowed 405 Method Not Allowed readbody=true>, @headers={"server"=>["nginx"], "date"=>["Mon, 27 Oct 2014 07:36:32 GMT"], "content-type"=>["text/plain"], "transfer-encoding"=>["chunked"], "connection"=>["close"], "status"=>["405 Method Not Allowed"], "allow"=>["OPTIONS, POST"], "cache-control"=>["no-cache"], "x-request-id"=>["d65ded44-b54c-4557-ac36-0f6aab49a288"], "x-runtime"=>["0.003609"]}>
How could avoid this problem? Please help me.
have it working fine on one ubuntu 14.04 server. the other throws an error:
Unable to get users
undefined method `response' for #<Errno::ECONNREFUSED: Connection refused - connect(2)>
this is driving me nuts. there doesn't seem to be any difference between the two servers. please advise
I can't seem to find in the docs where to put or how to tell the tool to use my config file with my API key
This feature would allow users to save a local file based on the snippet contents.
Add support for a global config that will merge with the user config. Warn if the user config isn't present. Also add a config that allows suppression of global config warning.
Snippet view shows double quotes surrounding the text and characters like " are escaped with .
Am I right there is no any merge request support at the moment?
Mimic RDoc format perhaps. Along the same lines, add RDoc documentation throughout code.
/usr/lib/ruby/1.8/uri/generic.rb:732:in merge': bad URI(is not URI?): #<GitlabCli::Project:0x7f2fefe13810>#<GitlabCli::Project:0x7f2fefe10200>#<GitlabCli::Project:0x7f2fefe0f3f0>#<GitlabCli::Project:0x7f2fefe0e5e0>#<GitlabCli::Project:0x7f2fefe0d7d0>#<GitlabCli::Project:0x7f2fefe0c9c0>#<GitlabCli::Project:0x7f2fefe0ba98>#<GitlabCli::Project:0x7f2fefe0ac38>#<GitlabCli::Project:0x7f2fefe09e00>#<GitlabCli::Project:0x7f2fefe08ff0>#<GitlabCli::Project:0x7f2fefe08140>#<GitlabCli::Project:0x7f2fefe07330>#<GitlabCli::Project:0x7f2fefe064d0>#<GitlabCli::Project:0x7f2fefe056c0>#<GitlabCli::Project:0x7f2fefe048b0>#<GitlabCli::Project:0x7f2fefe03aa0>#<GitlabCli::Project:0x7f2fefe02c68>#<GitlabCli::Project:0x7f2fefe01d68>#<GitlabCli::Project:0x7f2fefe00f30>#<GitlabCli::Project:0x7f2fefe00120>#<GitlabCli::Project:0x7f2fefdff270>#<GitlabCli::Project:0x7f2fefdfe438>#<GitlabCli::Project:0x7f2fefdfd600>#<GitlabCli::Project:0x7f2fefdfc7a0>#<GitlabCli::Project:0x7f2fefdfb990>#<GitlabCli::Project:0x7f2fefdfab80>#<GitlabCli::Project:0x7f2fefdf9d70>#<GitlabCli::Project:0x7f2fefdf8f38>#<GitlabCli::Project:0x7f2fefdf8010>#<GitlabCli::Project:0x7f2fefdf7200>#<GitlabCli::Project:0x7f2fefdf63c8>#<GitlabCli::Project:0x7f2fefdf5540>#<GitlabCli::Project:0x7f2fefdf46e0>#<GitlabCli::Project:0x7f2fefdf38d0>#<GitlabCli::Project:0x7f2fefdf2a70>#<GitlabCli::Project:0x7f2fefdf1c60>#<GitlabCli::Project:0x7f2fefdf0e50>/snippets/21 (URI::InvalidURIError) from /usr/lib/ruby/1.8/uri/common.rb:522:in
join'
from /usr/lib/ruby/1.8/uri/common.rb:521:in each' from /usr/lib/ruby/1.8/uri/common.rb:521:in
join'
from /usr/lib/ruby/gems/1.8/gems/gitlab_cli-2.0.0/lib/gitlab_cli/snippet.rb:22:in get_view_url' from /usr/lib/ruby/gems/1.8/gems/gitlab_cli-2.0.0/lib/gitlab_cli/snippet.rb:14:in
initialize'
from /usr/lib/ruby/gems/1.8/gems/gitlab_cli-2.0.0/lib/gitlab_cli/util/snippets.rb:26:in new' from /usr/lib/ruby/gems/1.8/gems/gitlab_cli-2.0.0/lib/gitlab_cli/util/snippets.rb:26:in
get_all'
from /usr/lib/ruby/gems/1.8/gems/gitlab_cli-2.0.0/lib/gitlab_cli/util/snippets.rb:25:in map' from /usr/lib/ruby/gems/1.8/gems/gitlab_cli-2.0.0/lib/gitlab_cli/util/snippets.rb:25:in
get_all'
from /usr/lib/ruby/gems/1.8/gems/gitlab_cli-2.0.0/lib/gitlab_cli/cli.rb:62:in snippets' from /usr/lib/ruby/gems/1.8/gems/thor-0.18.1/lib/thor/command.rb:27:in
send'
from /usr/lib/ruby/gems/1.8/gems/thor-0.18.1/lib/thor/command.rb:27:in run' from /usr/lib/ruby/gems/1.8/gems/thor-0.18.1/lib/thor/invocation.rb:120:in
invoke_command'
from /usr/lib/ruby/gems/1.8/gems/thor-0.18.1/lib/thor.rb:363:in dispatch' from /usr/lib/ruby/gems/1.8/gems/thor-0.18.1/lib/thor/base.rb:439:in
start'
from /usr/lib/ruby/gems/1.8/gems/gitlab_cli-2.0.0/bin/gitlab:4
from /usr/bin/gitlab:19:in `load'
from /usr/bin/gitlab:19
Update docs for 2.0.0 including classes, methods and commands. This will be the last piece to releasing 2.0.0
If you call edit on a snippet and quit the editor without writing changes, the snippet is still "updated." As in, old text is resaved and timestamp is updated. This should not happen ideally.
Example:
gitlab snippet add file.txt -t title -n name
Looks ok, right? But it gives a big ugly stack trace. In this case it was simply missing the project ID or name:
gitlab snippet add 13 file.txt -t title -n name
We should give some nicer messages that say something went wrong and here's maybe what happened...
Could we rename either the git repo (gitlab-cli
) or the gem (gitlab_cli
) so they use the same name, to make it easier to find one from the other?
They use badly designed error checking and things like 'exit 1'. Change this to the new style of groups
On editing you notice that all text is on one line and you see escaped double quotes and \n characters. Bad times.
Gitlab version: 5.0.1 (Turnkey appliance)
Installed via: "gem install gitlab_cli" command
Created config file in home directory.
When I try to run commands like "gitlab project add test_project" or "gitlab groups" I get the error --> "Could not find X command". It's weird that the command "gitlab projects" works fine though. Any ideas what could it be?
I need gitlab-cli tool to code a script which automates the creation of a couple hundreds of projects in gitlab web ui for my job. I've read the docs and I think this tool is awesome but I cannot make it work properly. Please help.
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.