Giter Club home page Giter Club logo

cli-git.io's Introduction

cli-git.io

shorten and/or unshorten GitHub.com URLs.

License: MIT

Installation

npm install -g cli-git.io or npm install --save cli-git.io.

Usage

Globally installed (CLI)

gitio [ [-v|--version] | [-h|--help] | [ shorten [--check|-c]|unshorten <url> ]

Examples

Help information
$ gitio -h 
Usage: gitio [ [-v|--version] | [-h|--help] |  [ shorten [--check|-c]|unshorten  <url> ] ]
Version
$ gitio --version
1.0.0
Shorten a github URL
  1. Ignore the validity of the URL
$ gitio shorten "https://github.com/Gyumeijie/cli-git.io"
https://git.io/fx2Bg

$ gitio shorten "https://github.com/Gyumeijie/non-existent-repo"
https://git.io/fx2B9
  1. Check the validity of the URL
$ gitio shorten -c "https://github.com/Gyumeijie/non-existent-repo"
Warning: https://github.com/Gyumeijie/non-existent-repo is not reachable!
https://git.io/fx2B9

$ gitio shorten "https://github.com/Gyumeijie/non-existent-repo" -c
Warning: https://github.com/Gyumeijie/non-existent-repo is not reachable!
https://git.io/fx2B9
Unshorten a short URL
$ gitio unshorten https://git.io/fx2B9
https://github.com/Gyumeijie/non-existent-repo

$ gitio unshorten https://git.io/bad-path

Notice: Woops! We can't seem to unshorten that URL, this could be for a few reasons:

1. it may not be a short URL in the first place;
2. it may not be a real URL or could no longer be active;
3. it may not be a short URL compatible with git.io!

Locally installed (APIs)

const githubURL = require('cli-git.io');

Examples

Shorten a github URL
shorten(rawURL, callback, check);
  1. Output result to stdout:
githubURL.shorten('https://github.com/Gyumeijie/cli-git.io');
  1. Pass the result to a callback:
githubURL.shorten('https://github.com/Gyumeijie/cli-git.io', function(shortURL) {
  // do some thing with the shorten URL here
});
  1. Check the validity of rawURL
githubURL.shorten('https://github.com/Gyumeijie/cli-git.io', undefined, true);
Unshorten a short URL
  1. Output result to stdout:
githubURL.unshorten('unshorten https://git.io/fx2B9');
  1. Pass the result to a callback:
githubURL.unshorten('unshorten https://git.io/fx2B9', function(rawURL) {
  // do some thing with the unshorten URL here
});

The GitHub.com URLs

The following are part of URLs which can be shorten or unshorten by cli-git.io:

  • https://help.github.com
  • https://guides.github.com
  • https://gist.github.com
  • https://raw.githubusercontent.com
  • https://page.github.com
  • https://developer.github.com
  • https://user.github.io

Links

cli-git.io's People

Stargazers

 avatar  avatar

Watchers

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