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! π©π°
$ npm install --global o-o
or
$ yarn global add o-o
$ 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
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
Are you saving important aliases or a large amount of them? If so, back these up, it's always possible they get corrupted.
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
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!
MIT Β© Dawson Botsford