This is a small command line program that shortens a URL, using the Bit.ly service.
As one of my first projects written in the Rust programming languages the code in this repository might not be the best in terms of style. Please, feel free to open an issue or a PR to help me improve my code!
To use this program, follow these steps:
- Clone the repository with
$ git clone git@github.com:feliix42/bitly-rs
- Build the project.
$ cd bitly-rs
$ cargo build --release
Of course you can spare the release flag if you want to help me develop this program.
- Run it!
$ target/release/bitly https://google.com
Please enter your Bit.ly token:
[enter your token here]
http://bit.ly/1NpyVCz
Note that you will be asked for a Bit.ly access token the first time you run the script. It will be saved to ~/.bitly-rs
.
Use $ bitly [long URL]
to shorten any URL that comes to your mind.
- Basic functionality
- manage OAuth2 Access Token more elegant
- take URL as command line argument
- Error Handling (e.g. no network)
- Better URL parsing
- change/remove the saved token
- Refactoring
- Documentation
I am in no way associated with Bitly™, the only reason that this project uses Bitly as shortening service is that it has a nice API that is easy to handle. $other_shortening_service
might also do a good job, sure!
bitly
is available under the MIT license. See the LICENSE file for more info.