0.01
No commit activity in last 3 years
No release in over 3 years
A Command Line Interface for consuming the Hackpad REST API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 0.1.2
~> 0.1.0
>= 0
>= 0
>= 0
 Project Readme

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://.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.

  • for v0.1.0
    • add freaking cool badges on the readme
    • cache the pads list in a local storage
    • have a choice to refresh cache
    • display cached date in output
    • write proper tests
  • for v0.2.0
    • clean the markdown generated by reverse_markdown
    • flood 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

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