1.0.0 • Published 8 years ago

node-gitio v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

node-gitio Build Status

A simple Node CLI wrapper for http://git.io.

In Terminal, simply enter gitio shrink followed by the GitHub URL you would like to shrink and the shortened URL will be copied automatically to your clipboard. Read more about git.io here.

Copying to clipboard is implemented via the copy-paste package which supports OSX, Windows, Linux, and OpenBSD.

A quick note: This is not a generic URL shortener. git.io—and by extension, this package—only shortens links that are hosted within the github.com domain.


Install

$ npm install -g node-gitio

Quick Visual Guide

$ gitio shrink github.com/.../my_cool_package

# => http://git.io/vZHUg  ✔ copied to clipboard


$ gitio shrink github.com/.../my_cool_package -c mycoolpackage

# => http://git.io/mycoolpackage  ✔ copied to clipboard

Usage

Usage: gitio [--version] [--help] <command> [<args>]

Commands:

  shrink  Shrink a GitHub URL.

Options:

       --help, -h  Show the help menu.

    --version, -v  Show version number.

Shrink

Usage: gitio shrink <long url> [-c code] [--help]

Options:

     --code, -c  A custom code for the short link, e.g. http://git.io/mycode. (Optional)

     --help, -h  Show the help menu.

Node JS API

var gitio = require('node-gitio');

gitio.shrink(payload, (err, result) => {
  if (!err) {
    console.log(result);
  }
});

Payload

NameTypeDescriptionRequired
urlstringThe GitHub URL to shorten. Only HTTPS is supported.
codestringA custom code for the short link, e.g. http://git.io/mycode.

Examples

  1. Shorten github.com/nathanbuchar/node-gitio.

    $ gitio shrink github.com/nathanbuchar/node-gitio
    
    # => https://git.io/vZ9RJ  ✔ copied to clipboard
  2. Shorten github.com/nathanbuchar/node-gitio and attempt to use nathan-gitio as the custom code (if available).

    $ gitio shrink github.com/nathanbuchar/node-gitio -c nathan-gitio
    
    # => https://git.io/nathan-gitio  ✔ copied to clipboard
  3. Shorten github.com/nathanbuchar/node-gitio via Node JS and log the result.

    var gitio = require('node-gitio');
    
    gitio.shrink({
      url: 'github.com/nathanbuchar/node-gitio'
    }, (err, result) => {
      if (!err) {
        console.log(result);
        // => https://git.io/vZ9RJ
      }
    });

Authors

License

MIT

1.0.0

8 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago