Skip to content

Make URL shortening effortless with the Zsh Plugin for GitHub.

License

Notifications You must be signed in to change notification settings

nicolodiamante/gitio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gitio

Git URLs can become cumbersome due to the long file names, leading to lengthy and often messy URLs that can be difficult to read. This can be particularly problematic when sharing URLs via email or social media. To address this issue, this plugin has been developed to use curl to shorten URLs, inspired by a similar service offered by GitHub called Git.io. The use of shortened URLs can not only improve readability but also make sharing URLs more convenient and efficient. This plugin allows users to enjoy the benefits of short and catchy Git URLs.

Note: This script utilises Git.io for URL shortening. Please be advised that as of January 2022, Git.io has announced that it is no longer accepting new links for shortening. Any links already shortened via Git.io will continue to operate as usual and stay accessible.


Getting Started

Download the repository via curl:

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

Alternatively, you can clone the repository manually:

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

Once you have downloaded the repository, navigate to the root directory of the repository, and then execute the installation script using the following command:

source utils/install.sh

The script is designed to search for the zshrc file and append the complete path to the gitio/script directory to the fpath variable. By doing this, the script ensures that the script directory is added to the list of paths that Zsh searches for when looking for executable scripts.

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 when lanced into a Git repository, the plugin will look for the URL in the config file located in the .git directory.

  • gitio [URL] shortens the URL but does not provide a vanity name for the shortened URL, resulting in no control over the output.

  • gitio [URL] [vanity-name] it allows users to provide a vanity name for the shortened URL. In a Git repository instead of having to type out the entire URL, users can simply enter the username/repo and the plugin will handle the rest.

  • gitio --retrieve [URL] fetch the full URL from the abbreviated URL.

  • gitio --open [URL] designed to exclusively function with GitHub URLs, will automatically launch the default browser to access the shortened URL.

For full gitio options, see gitio --help.

Notes

Resources

Contribution

Any suggestions or feedback you may have for improvement are welcome. If you encounter any issues or bugs, please report them to the issues page.

Nicolò Diamante Portfolio

MIT License