GithubHelp home page GithubHelp logo

weisjohn / gitlab-cli Goto Github PK

View Code? Open in Web Editor NEW

This project forked from drewblessing/gitlab-cli

0.0 2.0 0.0 122 KB

GitLab Command Line Tool - Interact with your GitLab server via the command line to manage snippets, projects and more.

License: Other

Ruby 100.00%

gitlab-cli's Introduction

GitLab CLI Tool

Many people prefer to work from the CLI when possible. This tool aims to bring some of the GitLab functionality into the CLI to avoid repeated trips to the web UI. At this time the tool only allows interaction with snippets.

GitLab Versions

This tool has only been tested with the following versions of GitLab. Some or all of the features may or may not work with other versions but they are not officially supported.

  • 5.1.0
  • 5.0.x

Project Setup

How do I get started?

  1. Clone this repo.
  2. Make sure you have bundler installed. gem install bundler
  3. Run bundle install in the root of the repository.
  4. Copy config.yml.sample to config.yml and edit the configuration as appropriate.
  5. Add the repo bin path to your environment PATH variable.

How can I find the private token for my user?

Login to your GitLab web UI, go to 'My Profile', and select the 'Account' tab. Copy the private token from the box and paste into your config.

How can I add the repo bin path to my environment PATH variable?

Place it in your ~/.bash_profile file. You should end up with something like this: export PATH=$PATH:/path/to/gitlab-cli/repo/bin/

Commands

Note: All command results are subject to user authorization. For example, if the command says it will return all projects it will return all projects...that the user is able to see.

Note2: Anywhere you see [PROJECT] you can either specify the full namespace/project name for the project or you can provide the project ID. Both can be obtained by running the first command below.

List all projects

gitlab projects

Example output:

3:	globalproject1
4:	namespace1/project2
6:	namespace1/project3
11:	namespace2/project1
13:	user1/project1

List all snippets for a project

Usage: gitlab snippets [PROJECT]

Using project ID: gitlab snippets 13

Using project full namespace/project format: gitlab snippets user1/project1

Example output:

2:  Title - Filename
16:	README - README.md

View a snippet (Uses default pager or "less")

Usage: gitlab snippet view [PROJECT] [SNIPPET_ID]

Using project ID: gitlab snippet view 13 16

Using project full namespace/project format: gitlab snippet view user1/project1 16

Edit a snippet (Users default editor or "vi")

Usage: gitlab snippet edit [PROJECT] [SNIPPET_ID]

Using project ID: gitlab snippet edit 13 16

Using project full namespace/project format: gitlab snippet edit user1/project1 16

Example output:

Snippet updated.
 URL: https://gitlab.example.com/user1/project1/snippets/16

View detailed information about a snippet

Usage :gitlab snippet info [PROJECT] [SNIPPET_ID]

Using project ID: gitlab snippet info 13 16

Using project full namespace/project format: gitlab snippet info user1/project1 16

Example output:

Snippet ID: 16
Title: README
File Name: README.md
Author: John Doe <[email protected]>
Created at: Fri Apr 19 01:11:08 UTC 2013
Updated at: Fri Apr 19 01:11:08 UTC 2013
Expires at: Never

Add a snippet

Usage 1: gitlab snippet add [PROJECT] [FILE] -t [TITLE] -n [FILE_NAME]

Usage 2: cat [FILE] | gitlab snippet add [PROJECT] -t [TITLE] -n [FILE_NAME]

Using project ID: gitlab snippet add 13 16 /path/to/file -t "Awesome title" -n file.txt

Using project full namespace/project format: `gitlab snippet add user1/project1 16 /path/to/file -t "Awesome title" -n file.txt``

Example output:

Snippet created.
ID: 20
URL: https://gitlab.example.com/user1/project1/snippets/20

Delete a snippet (Asks for confirmation)

Usage: gitlab snippet delete [PROJECT] [SNIPPET_ID]

Using project ID: gitlab snippet delete 13 16

Using project full namespace/project format: gitlab snippet delete user1/project1 16

Save a snippet to your local filesystem

Note: The "save" subcommand is an alias of "download." Both have the same effect.

Usage 1: gitlab snippet download [PROJECT] [SNIPPET_ID] [FILE]

Usage 2: gitlab snippet save [PROJECT] [SNIPPET_ID] [FILE]

Using project ID: gitlab snippet save 13 16 /path/for/new/file

Using project full namespace/project format: gitlab snippet download user1/project1 16 /path/for/new/file

Issues

If you encounter issues with this project, please find help via one of these avenues.

  1. IRC: #gitlab on Freenode - nick dblessing
  2. GitHub Issues: Open a new issue here on GitHub

Contributing changes

I welcome all contributions. If you would like to include a new feature or bug fix, simply open a pull request and explain the problem or feature you contributed. I will review the contribution at that point. If you want to discuss fixes or improvements before submitting a pull request, please find me on IRC #gitlab on Freenode or open a GitHub issue.

License

See LICENSE file.

gitlab-cli's People

Contributors

drewblessing avatar weisjohn avatar

Watchers

 avatar James Cloos avatar

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.