shorten and/or unshorten github.com URLs.
npm install -g cli-git.io
or npm install --save cli-git.io
.
gitio [ [-v|--version] | [-h|--help] | [ shorten [--check|-c]|unshorten <url> ]
$ gitio -h
Usage: gitio [ [-v|--version] | [-h|--help] | [ shorten [--check|-c]|unshorten <url> ] ]
$ gitio --version
1.0.0
- 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
- 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
$ 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!
const githubURL = require('cli-git.io');
shorten(rawURL, callback, check);
- Output result to stdout:
githubURL.shorten('https://github.com/Gyumeijie/cli-git.io');
- 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
});
- Check the validity of rawURL
githubURL.shorten('https://github.com/Gyumeijie/cli-git.io', undefined, true);
- Output result to stdout:
githubURL.unshorten('unshorten https://git.io/fx2B9');
- Pass the result to a callback:
githubURL.unshorten('unshorten https://git.io/fx2B9', function(rawURL) {
// do some thing with the unshorten URL here
});
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