# surl-cli

> URL shortener CLI

Latest version **2.0.4** (published 2018-10-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install surl-cli
pnpm add surl-cli
yarn add surl-cli
bun add surl-cli
```

Provides the command `surl`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2018-10-26 |
| First published | 2018-07-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 9 |
| Unpacked size | 31.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Hank Chan |
| Maintainers | hankchanocd |
| Keywords | shortenUrl, surl, url, cli, bit.ly, firebase, goo.gl |

## Links

- npm: https://www.npmjs.com/package/surl-cli
- Repository: https://github.com/hankchanocd/surl-cli
- Homepage: https://github.com/hankchanocd/surl-cli#readme
- Issues: https://github.com/hankchanocd/surl-cli/issues
- npm.io page: https://npm.io/package/surl-cli

## Dependencies (9)

- [conf](https://npm.io/package/conf.md) 1.4.0
- [bitly](https://npm.io/package/bitly.md) ^6.0.8
- [chalk](https://npm.io/package/chalk.md) ^2.4.1
- [cliui](https://npm.io/package/cliui.md) ^4.1.0
- [inquirer](https://npm.io/package/inquirer.md) 5.2.0
- [columnify](https://npm.io/package/columnify.md) ^1.5.4
- [commander](https://npm.io/package/commander.md) ^2.18.0
- [clipboardy](https://npm.io/package/clipboardy.md) ^1.2.3
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.2.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 2.0.4 (latest) — 2018-10-26
- 2.0.3 — 2018-10-20
- 2.0.2 — 2018-10-10
- 2.0.1 — 2018-10-09
- 2.0.0 — 2018-10-07
- 1.3.2 — 2018-09-18
- 1.3.1 — 2018-08-31
- 1.3.0 — 2018-08-02
- 1.1.1 — 2018-07-30
- 1.1.0 — 2018-07-30
- 1.0.0 — 2018-07-28

## README

# surl-cli &nbsp;&nbsp; [![npm](https://img.shields.io/npm/v/surl-cli.svg)](https://www.npmjs.com/package/surl-cli) [![Build Status](https://travis-ci.org/hankchanocd/surl-cli.svg?branch=master)](https://travis-ci.org/hankchanocd/surl-cli) [![Known Vulnerabilities](https://snyk.io/test/github/hankchanocd/surl-cli/badge.svg?targetFile=package.json)](https://snyk.io/test/github/hankchanocd/surl-cli?targetFile=package.json) ![Github issues](https://img.shields.io/github/issues/hankchanocd/surl-cli.svg)

> CLI for shortening URL with **Firebase**, **Bitly**, **Goo.gl** API.

No more distraction from leaving to a web page just to create a short URL. `surl` is a CLI tool for shortening URL and retrieving URL's usage statistics from many API providers, including but not limited to **Bitly**, **Firebase**, and **Goo.gl**. The key advantage of **Firebase** API allows you to create links for Android and iOS apps in addition to web platform.

## Install

```bash
$ npm install surl-cli -g
```

## Usage

### Init

Before start using `surl`, initialize configuration with `surl init` to select a default API provider. You must save at least one API key/token to `surl` from one of the three API providers (Bitly, Firebase, Goo.gl). While you can choose to store every API keys/tokens from all three service providers, `surl` only allows the default provider to be used at one time.

- Follow the [guide](./bitly.md) to go to **Bitly**'s API page to receive your API key/token.
- Follow the [guide](./firebase.md) to go to **Firebase (FDB)**'s API page to receive your API key/token.
- To comply with [Google's policy](https://developers.googleblog.com/2018/03/transitioning-google-url-shortener.html) on sunsetting **goo.gl** service on **May 2019**, we recommend users not to use URL shortening service from goo.gl. However, existing users of goo.gl can still receive their API keys/tokens at [console](https://console.developers.google.com/apis/credentials?project=constant-jigsaw-188105&folder&organizationId) until May 2019, while no new users are allowed to register with the service.

```
$ surl init
=> select your API provider (Bitly, Firebase, Google)
=> provide your API key/token
```

### Config

Update your API key/token and change the default API provider after `surl init`

```
$ surl config
```

### Shorten URL

```
$ surl www.example.com/test/test
=> success! https://goo.gl copied to clipboard
```

### Expand URL

```
$ surl --reverse goo.gl   (or)   surl -r goo.gl
=> success! expanded url copied to clipboard
```

### Stats

Fetch shortened URL's meta data and usage statistics, available only if the chosen provider has such feature.

```
$ surl --stats goo.gl
=> shortUrl: goo.gl
   origin: www.example.com/test/test
   created: 2009 11 12
   clicks:
       PERIOD   SHORTURL  LONGURL      COUNTRIES DATA
       allTime  30        40           Canada       5
       month    0         0            Australia    2
       week     0         0
       day      0         0
       twoHours 0         0
```

### Help

Should you have any doubt, refer to help page.

```
$ surl --help
```

## Tests

To run unit tests and API tests, run `npm test`.

## Contributing

Development of `surl` now focuses on transforming URLs. Any other suggestions are welcomed, but will have to wait until the next major release.
For more details, please refer to [Contribution](./CONTRIBUTION.md).

## FAQ

1. Why is **ow.ly** not included in the CLI?

   Access to **ow.ly** API is restricted to the enterprise users of its parent company, Hootsuite. At this point, I don't see many paid users of Hootsuite requesting this feature. You can still use **ow.ly** service on Hootsuite's website though.

## License

[MIT License](./LICENSE.md) | Copyright (c) 2018 Hank Chan

---
_Source: https://npm.io/package/surl-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
