Giter Site home page Giter Site logo

gitlab-cli's Issues

Implement better error checking

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.

Don't need to `inspect` snippet content.

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.

`projects` command only shows 20 projects, no options to paginate

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

Add ability to configure output level

Allow user to configure output levels. Levels could be:

  • Debug - Show all output
  • Normal - Show info output plus warnings
  • NoWarn - Show info output and suppress warnings

Create a config file in $HOME folder instead of using config.yml

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.

Improve error handling for times when Gitlab is not accessible

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

Throw error when passing a invlid project id

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 methodprojects' 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:ininfo'
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:ininvoke_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:ininvoke'
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:inrun'
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:indispatch'
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

'

Fix subcommand usage print out

The snippet/project subcommands output incorrect usage information:
"gitlab edit [PROJECT] [SNIPPET_ID]" instead of "gitlab snippet edit [PROJECT] [SNIPPET_ID]".

Add create project feature

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.

"405 Method Not Allowed" on User session creation

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.

Same install; one works the other doesn't

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

Config Location

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

Add support for global config

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.

Strange error if you try to run snippet command on project that isn't accessible

/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:injoin'
from /usr/lib/ruby/1.8/uri/common.rb:521:in each' from /usr/lib/ruby/1.8/uri/common.rb:521:injoin'
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:ininitialize'
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:inget_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:inget_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:insend'
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:ininvoke_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:instart'
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

Update docs for 2.0.0 including classes, methods and commands. This will be the last piece to releasing 2.0.0

Better error messages when options are misplaced or missing

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

Error "Could not find X command"

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.

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.