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.
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.
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://.hackpad.com/ep/account/settings/ (your subdomain is where you store the pads).
(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.
Check the Changelog for past evolutions.
for v0.1.0add freaking cool badges on the readmecache the pads list in a local storagehave a choice to refresh cachedisplay cached date in outputwrite proper tests
- for v0.2.0
clean the markdown generated by reverse_markdownflood hackpad support to get some improvements done- add a command for searching on local cache, in titles only or in body
- elaborate a better search syntax so we can have and/or and strings
- add commands for creating a new pad, linked to $EDITOR
- add a gateway to github so a pad could be copied over a wiki page directly or in a repo somehow
- for v0.3.0
- add admin commands for managing users
- implement pretty much all what the hackpad API v1 offers
- nag hackpad for they add REST endpoints to query collections
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
(c) Copy is right, 2014 - mose - this code is distributed under MIT license