2 releases
0.1.1 | Mar 22, 2021 |
---|---|
0.1.0 | Mar 22, 2021 |
#24 in #link-shortener
11KB
100 lines
tinyurl
An abstraction on top the tinyurl API in rust for quickly generating short urls.
Library
- Builder
use tinyurl::TinyURL;
// without alias
let short = TinyURL::new("https://example.com").build();
assert!(short.is_ok());
// with alias
let aliased = TinyURL::new("https://example.com")
.alias("some-random-nickname")
.build();
assert!(aliased.is_ok());
- Macro
use tinyurl::tiny;
// without alias
let short = tiny!("https://github.com");
assert!(short.is_ok());
// with alias
let short = tiny!("https://github.com", alias = "random-random-alias");
assert!(short.is_ok());
CLI
- Install
cargo install tinyurl
- Usage
tinyurl 0.1.0
Collins Muriuki <murerwacollins@gmail.com>
An abstraction on top the tinyurl API in rust for quickly generating short urls.
USAGE:
tinyurl [OPTIONS] <uri>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-a, --alias <alias> Optional unique url alias
ARGS:
<uri> The uri to be shortened
Dependencies
~6–18MB
~241K SLoC