https://github.com/iddm/urlshortener-cli
A urlshortener command line interface
https://github.com/iddm/urlshortener-cli
rust shorten-urls url url-shortener urlshortener-cli
Last synced: about 1 year ago
JSON representation
A urlshortener command line interface
- Host: GitHub
- URL: https://github.com/iddm/urlshortener-cli
- Owner: iddm
- License: mit
- Created: 2016-11-14T11:11:19.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-05-30T13:25:42.000Z (about 2 years ago)
- Last Synced: 2024-11-10T09:17:17.495Z (over 1 year ago)
- Topics: rust, shorten-urls, url, url-shortener, urlshortener-cli
- Language: Rust
- Size: 80.1 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# urlshortener-cli
[](https://crates.io/crates/urlshortener-cli)
[](https://travis-ci.org/vityafx/urlshortener-cli)
[](./LICENSE)
A very simple urlshortener program written in Rust language. It uses [urlshortener](https://github.com/iddm/urlshortener-rs) rust library as data provider.
## Installing with `Cargo`
```
cargo install urlshortener-cli
```
## Usage
The interface is minimal as possible:
```
$ urlshortener-cli http://google.ru http://yandex.ru
http://google.ru -> https://is.gd/h5kR5r
http://yandex.ru -> https://is.gd/CifrPx
```
If your url has escaped characters just wrap it with quotes:
```
$ urlshortener-cli "https://www.google.ru/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwiclOPp3OTRAhVyb5oKHUzyCl8QFggpMAE&url=http%3A%2F%2Ftest.tankionline.com%2F&usg=AFQjCNFIEFFpu2m_QofHelAXRK0JP4dLOQ&sig2=Fc6eFhPDqNgt5kZMzRWPIA"
https://www.google.ru/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwiclOPp3OTRAhVyb5oKHUzyCl8QFggpMAE&url=http%3A%2F%2Ftest.tankionline.com%2F&usg=AFQjCNFIEFFpu2m_QofHelAXRK0JP4dLOQ&sig2=Fc6eFhPDqNgt5kZMzRWPIA -> https://is.gd/jIsDF1
```
The crate supports setting the clipboard content with the optional
`--set-to-clipboard` argument. The shortened links are then copied into
the clipboard for easier use.
```
$ urlshortener-cli --set-to-clipboard "https://google.com"
```
The crate also supports gets the links to shorten from the clipboard.
For this, use the `--get-from-clipboard` argument.
```
$ urlshortener-cli --get-from-clipboard
```
Note that getting the links from the clipboard may be messy on Linux if
the clipboard managers are used.
## Integration with Desktop Environments
### Hyprland
Create a key shortcut to use the shortener: in your quickly
`~/.config/hypr/hyprland.conf`, put something like this:
```
bind = $mainMod, L, exec, urlshortener-cli --get-from-clipboard --set-to-clipboard
```
Then, just copy a link to your clipboard, and invoke the shortcut, if done like this, -
the `MOD key + L`, to shorten the link. The resulting short link will be in the
clipboard.
## License
This project is [licensed under the MIT license](./LICENSE).