gitio (nicolodiamante) - Uses git.io to shorten git urls.

gitio (nicolodiamante) - Uses git.io to shorten git urls.

gitio Title

Git URLs can get pretty long since we might have long names for repositories and files. A long URL will look messy, sometimes difficult to read. Short URLs look better, especially when we need to share them on emails and socials. To hand over this problem, this plugin—inspired by a service provided by GitHub (Git.io)—shorten URLs using curl.

Getting Started

Download the repository via curl:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/nicolodiamante/gitio/HEAD/bootstrap.sh)"

Alternatively, clone manually:

git clone https://github.com/nicolodiamante/gitio.git ~/gitio

Head over into the directory and then:

cd utils && source install.sh

The script will look for the zshrc and then append the full path to the gitio/script directory to the fpath:

fpath=(~/gitio/script $fpath)
autoload -Uz gitio

Install via Oh My Zsh

git clone https://github.com/nicolodiamante/gitio.git $ZSH_CUSTOM/plugins/gitio
  • Add to your zshrc plugins array plugins=(... gitio)
  • Restart the shell to activate

How to Use gitio

  • gitio: inside a git repository, it will search for the URL within the config file inside the .git directory.

  • gitio [URL]: shortens the URL but without a vanity name given there is no control of the output.

  • gitio [URL] [vanity-name]: shortens and changes the URL with the vanity name given. Instead of typing the entire URL you can type only the username/repo.

  • gitio --retrieve [URL]: retrieves the original URL from the shortened URL.

  • gitio --open [URL]: opens the URL in the default browser (works only with GitHub URLs).

For full gitio options, see gitio --help.

Notes

Resources

Contribution

Please report any issues or bugs to the issues page. Suggestions for improvements are welcome!

Nicolò Diamante Portfolio

The MIT License

Download Source Code

Download ZIP
Mar 12, 2022