πŸ‘“ Bookmarks but for the terminal
JavaScript HTML
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
media
.editorconfig
.gitattributes
.gitignore
.travis.yml
license
package.json
readme.md
test.js
yarn.lock

readme.md

npm version build status xo code style

Browser bookmarks, but for the terminal


$ 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

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

Usage

$ o <alias>

Opens the path associated with <alias>.


Print saved aliases:

$ 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:

$ 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:

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

The verbose way

$ o new https://facebook.com fb

It's not just for url's:

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

$ o or
# opens file with default application

Help:

$ 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 <alias> # delete an alias
    $ o clear # delete all
    $ o path # print file path to alias file

Dynamic Templating

Aliases can (optionally) have handlebars 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:

$ 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

$ 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:

$ 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

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.

$ 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