Home

Awesome

Hackpad-Cli

Gem Version Downloads Build Status Coverage Status Dependency Status Code Climate


This is a command-line utility to check and manipulate hackpad documents. It uses Hackpad REST API 1.0 and was tested with ruby 1.9.3 and 2.2.3.

Initially this tool was created to overcome the frustration of the md export of pads, because we need to copy them to other places sometimes. Proper markdown would be appreciated. It does that by transforming the html in markdown with the https://github.com/xijo/reverse_markdown gem, and applying some extra cleaning over it.

Offline hackpad reading

It felt right to cache the pads content and list because then we can browse and search in the whole workspace very fast. So by default the list, show and info are cached unless you pass the -r option at the end of the commandline. Note that the longest is the list because the API don't provide pads titles, so hpcli list actually downloads the whole list of the pads in txt format. But it makes the info and the show very fast after that.

The side effect is that it provides the ability to just refresh the list of pads with hpcli list, and it will cache the text version of each pad locally. Then you can hpcli show <xxx> without hitting the api.

Installation

gem install hackpad-cli

or

git clone https://github.com/mose/hackpad-cli.git
cd hackpad-cli
bundle install

Then you will have to launch it once and it will ask you some questions. you can find your client_id and secret at https://<subdomain>.hackpad.com/ep/account/settings/ (your subdomain is where you store the pads).

Usage

(use bundle exec if you need, mostly in clone mode when not using rvm)

Commands:
  hpcli add                     # Add a new workspace.
  hpcli default                 # change the default workspace.
  hpcli getnew                  # Downloads the new pads the are not cached yet (options: -u to show urls).
  hpcli help [COMMAND]          # Describe available commands or one specific command
  hpcli info [pad_id]           # gets info for the pad <pad_id>.
  hpcli list                    # Lists available pads (options: -u to show urls, -r to refresh).
  hpcli search [term]           # Lists available pads matching [term] (options: -u to show urls)
  hpcli show [pad_id] [format]  # shows pad <pad_id> in format [html,txt,md], default txt (options: -r to refresh).
  hpcli stats                   # Lists configuration values.
  hpcli version                 # Displays the hackpad-cli version.
  hpcli workspaces              # Lists configurated hackpad workspaces.

Options:
  -c, [--basedir=BASEDIR]      # Path to the hackpad-cli directory to use.
                               # Default: /home/mose/.hackpad-cli/
  -w, [--workspace=WORKSPACE]  # Name of the workspace to use.
                               # Default: default
  -p, [--plain], [--no-plain]  # Add this if you don't want colors.

At first launch it will create your config dir (default ~/.hackpad-cli/), and will ask you questions to create the config file (default is default/config.yml). If you pass the -w whatever option at the end, it will ask questions again to write whatever/config.yml config file.

Roadmap and todoz

Check the Changelog for past evolutions.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright

(c) Copy is right, 2014 - mose - this code is distributed under MIT license