The command line interface to Cacher.
Last updated a year ago by cacher.rui .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @cacherapp/cli 
SYNC missed versions from official npm registry.

Cacher CLI

Cacher CLI - The command line interface to Cacher, the code snippet organizer for pro developers.

Cacher logo

Version Downloads/week License

The Cacher CLI allows power users to perform common actions on their Cacher libraries.

The CLI is constantly evolving. Check back often for updates and new commands.


CLI demo

Getting Started



To view your Cacher API credentials, visit: https://app.cacher.io/enter?action=view_api_creds

Note the API key and token in the dialog:

From a terminal window, run:

npm install -g @cacherapp/cli
cacher setup
? API key: ****************
? API token: ********************************

If all goes well, your credentials will be saved and you can execute CLI commands.



Configure API credentials for Cacher CLI. To view your API token and key visit: https://app.cacher.test/enter?action=view_api_creds

  $ cacher setup

  -k, --key=key      api key for Cacher account
  -t, --token=token  token for Cacher account

  cacher setup
  ? API key: ****************
  ? API token: ********************************

  cacher setup --key=fe33cd82ae161ba1 --token=0134a0be884468829669c3be02c3a814

See code: lib/commands/setup/index.ts


Add a new snippet to your Cacher personal/team library. By default, creates snippet using clipboard contents. Append filename argument to use file contents instead.

  $ cacher snippets:add [FILENAME]

  -d, --description=description  snippet description
  -f, --filename=filename        filename for content (will override name of file passed in)
  -m, --team=team                screenname of team library that snippet will be created in
  -q, --quiet                    minimal feedback
  -t, --title=title              snippet title
  -u, --public                   save as public snippet

  $ cacher snippets:add
  ? Snippet title: Example from System Clipboard
  ? Description: Snippet created from contents in the clipboard.
  ? Filename: my_file_from_clipboard.md

  $ cacher snippets:add ~/MyCode/example.rb
  ? Snippet title: Example for CLI
  ? Description: This is an example for the Cacher CLI.

  $ cacher snippets:add --filename=my_file_from_clipboard.md \
      --title="Public example from System Clipboard" \
      --description="Snippet created from contents in the clipboard" \
      --team=cacher-dev-ops --public --quiet

See code: lib/commands/snippets/add.ts


Start a Run Server to accept requests from a given origin. The Run Server is used to run shell commands using Cacher snippet file contents. Run this command in tandom with the Cacher's standalone Run Server option.

For more information about the Run Server and its configuration, check out @cacherapp/cacher-run-server.

  $ cacher run-server:start

  -l, --logToFile      log output to server log file (~/.cacher/logs/run-server.log)
  -o, --origin=origin  http(s) origin for CORS requests (use "file://" with Cacher Desktop, "https://app.cacher.io" with Web App)
  -p, --port=port      port to run server on
  -t, --token=token    server token to check against while making connections
  -v, --verbose        show verbose logging

  $ cacher run-server:start -o https://myapp.dev -p 30012 -t my_server_token

    Listening on: http://localhost:30012
    Server token: my_server_token


# With origin "https://app.cacher.io", generate port and token
cacher run-server:start

# With origin "file://" for Cacher Desktop Client, specify port and token
cacher run-server:start -o file:// -p 12345 -t secret

# Verbose output, logged to "~/.cacher/logs/run-server.log"
cacher run-server:start -v -l

Starting the server on a remote machine

Running a remote server ensures all your developers are able to run snippet file commands against the same environment.

Note: Since the commands will be run using the shell account from which you launch the CLI, we recommend you use only machines which are for testing or are ephemeral (i.e. Docker instances).

Example of launching with a secure tunnel (ngrok).

cacher run-server:start -p 39135 -t 4D5dzRGliafhGg~btNlR9 -o file:// -v
ngrok http 39135

You can then connect to the server via Cacher's Standalone option:

Connect to Standalone Run Server


Open the user configuration for the Run Server. Add rules here to handle additional file extensions.

  $ cacher run-server:config

  -e, --editor=editor  open configuration file with editor (i.e. "atom")

  $ cacher run-server:config
  $ cacher run-server:config -e atom

View documentation on the user configuration rule format.


Show the server log file.

  $ cacher run-server:log

  -n, --lines=lines  show the last n lines of the log
  -t, --tail         follow the Run Server log

  $ cacher run-server:log
  $ cacher run-server:log -t
  $ cacher run-server:log -n 100

Command Help

cacher help                 # View description and command topics
cacher help snippets        # Help on snippets commands
cacher help snippets:add    # Help and usage for the snippets:add command

Libraries Used

  • oclif - Heroku's open CLI framework.
  • chalk - Terminal styling for Node.
  • node-copy-paste - Cross-platform clipboard support.

Author / License

Released under the MIT License by Rui Jiang of Cacher.

Current Tags

  • 1.0.10                                ...           latest (a year ago)

15 Versions

  • 1.0.10                                ...           a year ago
  • 1.0.9                                ...           a year ago
  • 1.0.8                                ...           2 years ago
  • 1.0.7                                ...           2 years ago
  • 1.0.6                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (20)
Dev Dependencies (6)
Dependents (0)

Copyright 2014 - 2017 © taobao.org |