An open API service indexing awesome lists of open source software.

https://github.com/dawsbot/o-o

👓 Bookmarks but for the terminal
https://github.com/dawsbot/o-o

browser developer-tools

Last synced: about 1 year ago
JSON representation

👓 Bookmarks but for the terminal

Awesome Lists containing this project

README

          






npm version


build status


xo code style

> Browser bookmarks, but for the terminal


```sh
$ o new https://github.com gh
✔ Created new alias "gh"

# days, months, or years later

$ o gh
opening https://github.com

🎩🐰 It's like magic, your browser opens github! 🎩🐰
```

## Install

```sh
$ npm install --global o-o
or
$ yarn global add o-o
```

## Usage

```sh
$ o
```

Opens the `path` associated with ``.


Print saved aliases:

```sh
$ o ls
# {
# "o": "https://github.com/dawsbot/o-o",
# "so": "https://stackoverflow.com/search?q={{o0}}",
# "g": "https://github.com/{{o0}}/{{o1}}"
# }
```


`o` can also be used with dynamic `path`'s:

```sh
$ o so "that thing I can never remember how to do"
# opens https://stackoverflow.com/search?q=that%20thing%20I%20can%20never%20remember%20how%20to%20do in your browser
```


Add your own:

```sh
$ o new
# spawns an informative prompt for you to save a new alias
```

The verbose way

```sh
$ o new https://facebook.com fb
```


It's not just for url's:

```sh
$ o new /Users/dawsbot/code/o-o/readme.md or

$ o or
# opens file with default application
```


Help:

```sh
$ o --help

Usage
$ o [alias|command] [, arguments]

Examples
$ o # create new alias
$ o new # create or rename alias
$ o ls # print list of saved aliases
$ o rm # delete an alias
$ o clear # delete all
$ o path # print file path to alias file
```


## Dynamic Templating

Aliases can (optionally) have [handlebars](http://handlebarsjs.com/) templates. This allows arguments to be dynamically inserted into a `path`. If you have never used handlebars, don't fear. It's simple.

`o` handlebars templates are 0-indexed, just like an array. They begin at `o0` and continue to `o1`, `o2`, etc.

Here's another example:

```sh
$ o so "how to do something"
# o retrieves "https://stackoverflow.com/search?q={{o0}}" and
# replaces "{{o0}}" with url-encoded "how to do something"
```

Here's a fun example of making a sub-reddit alias

```sh
$ o new https://reddit.com/r/{{o0}} reddit
# ✔ Created new alias reddit

$ o reddit node
# opens https://www.reddit.com/r/node in browser
```


## Backup important aliases

Are you saving important aliases or a large amount of them? If so, back these up, it's always possible they get corrupted.

#### Backup to Dropbox

First find the path your config file is saved in:

```sh
$ o path
# /Users/dawsonbotsford/Library/Preferences/o-o-nodejs/config.json
```

This file needs to be moved into Dropbox and symlinked back to the original location

```sh
mv /Users/dawsonbotsford/Library/Preferences/o-o-nodejs/config.json ~/Dropbox/
ln -s ~/Dropbox/config.json /Users/dawsonbotsford/Library/Preferences/o-o-nodejs/config.json
```

#### Backup to git

Alternatively, use git to manually version control.

```sh
$ o path
# /Users/dawsonbotsford/Library/Preferences/o-o-nodejs/config.json
$ cd /Users/dawsonbotsford/Library/Preferences/o-o-nodejs/
$ git init
# add remote, and push!
```


## License

MIT © [Dawson Botsford](http://dawsonbotsford.com)