o-o

Terminal-cli for browser bookmarks (pronounced "oh oh")

Usage no npm install needed!

<script type="module">
  import oO from 'https://cdn.skypack.dev/o-o';
</script>

README

npm version build status xo code style

a cli for opening things like url's and files (pronounced "oh oh")


Install

$ npm install --global o-o

Usage

$ o <alias>

Opens the path associated with <alias>.


For example:

$ o o
# opens https://github.com/dawsbot/o-o in your browser

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