README.md in pinpress-1.2.0 vs README.md in pinpress-1.2.1
- old
+ new
@@ -4,29 +4,29 @@
PinPress is a simple CLI to create templates (HTML, Markdown, or otherwise) of Pinboard pins and tags.
# Why?
-Every two weeks, I create a "link mash" for my website; this link mash consists of URLs that I find interesting and want to share with my readers. Previously, I would save those interesting URLs to an Evernote note and, every two weeks, manually create my link mash for use in Wordpress. <barf/>
+Every week, I create a [link mash for my blog](#link-mash-config-file); this link mash consists of URLs that I find interesting and want to share with my readers. Previously, I would save those interesting URLs to an Evernote note and, every week, manually create my link mash for use in Wordpress. `<barf/>`
When I began using [Pinboard](http://pinboard.in "Pinboard") to save interesting links, I knew I needed a better method. This tool is the result: **Pin** board + Word **press**.
# Prerequisites
In addition to Git (which, given you being on this site, I'll assume you have), Ruby (v. 1.9.3 or greater) is needed.
# Installation
-```
+```bash
gem install pinpress
```
# Usage
Syntax and usage can be accessed by running `pinpress help`:
-```
+```bash
$ pinpress help
NAME
pinpress - A Pinboard application that allows for the creation of
"pin templates" in almost any conceivable format.
@@ -48,11 +48,11 @@
templates - Work with templates for pin output
```
Note that each command's options can be revealed by adding the `--help` switch after the command. For example:
-```
+```bash
$ pinpress pins --help
NAME
pins - Get posts from Pinboard
SYNOPSIS
@@ -65,35 +65,152 @@
-t arg - The tags to use (e.g., "ruby,pinboard") (default: none)
```
# Initialization
-```
+```bash
$ pinpress init
```
Initialization will prompt you to enter your Pinboard API token. Once, entered, this (and other pertinent data) will be stored in `~/.pinpress`.
+# Getting Pins
+
+```bash
+$ pinpress pins
+```
+
+This simple command will return all pins from the user's account and output them based on the [Pin Template](#pin-templates "Pin Templates") provided.
+
+Pinpress also provides some flags that allow a user to define specific pins to grab:
+
+* `-s`: the start date to use (uses [Chronic](https://github.com/mojombo/chronic "Chronic"), which allows dates like "last Tuesday")
+* `-e`: the end date to use (also uses [Chronic](https://github.com/mojombo/chronic "Chronic"))
+* `-n`: the number of pins to return (e.g., 20)
+* `-t`: a CSV list of tags (e.g., "tag1,tag2") that must exist for the returned pins
+
+## Getting Pins From a Date Forward
+
+```bash
+$ pinpress pins -s 2014-01-01
+```
+
+...returns all pins from January 1, 2014 to the current day.
+
+## Getting Pins Until a Date
+
+```bash
+$ pinpress pins -e 2014-01-01
+```
+
+...returns all pins up to January 1, 2014.
+
+## Getting Pins Between a Date Range
+
+```bash
+$ pinpress pins -s 2014-01-01 -e 2014-01-31
+```
+
+## Getting Tagged Pins
+
+```bash
+$ pinpress pins -t "ruby,cli"
+```
+
+...returns all pins tagged "ruby" *and* "cli".
+
+**Naturally, these flags can be combined in any number of ways.**
+
+## Getting Pins Created Since Last Run
+
+Every time you run `pinpress pins`, the current date is added to `~/.pinpress`. Because of this, running:
+
+```bash
+$ pinpress pins last
+```
+
+...will get all the pins created since that date (e.g., if you'd last run `pinpress pins` on 2014-01-01, this command would return all pins created from 2014-01-02 onward).
+
+# Getting Tags
+
+Pinpress can also work with tags in a Pinboard account:
+
+```bash
+$ pinpress tags
+```
+
+This simple command will return all tags from the user's account and output them based on the [Tag Template](#tag-templates "Tag Templates") provided.
+
+Pinpress also provides some flags that allow a user to define specific tags to grab:
+
+* `-s`: the start date to use (uses [Chronic](https://github.com/mojombo/chronic "Chronic"), which allows dates like "last Tuesday")
+* `-e`: the end date to use (also uses [Chronic](https://github.com/mojombo/chronic "Chronic"))
+* `-t`: a CSV list of tags (e.g., "tag1,tag2") to examine for association (see [below](#getting-tags-that-have-been-used-with-other-tags)).
+
+## Getting Tags From a Date Forward
+
+```bash
+$ pinpress tags -s 2014-01-01
+```
+
+...returns all tags used from January 1, 2014 to the current day. Note that for each tag returned, the data includes both the tag name and the number of times it was used.
+
+## Getting Tags Until a Date
+
+```bash
+$ pinpress tags -e 2014-01-01
+```
+
+...returns all tags used up to January 1, 2014.
+
+## Getting Tags Between a Date Range
+
+```bash
+$ pinpress tags -s 2014-01-01 -e 2014-01-31
+```
+
+## Getting Tags that Have Been Used With Other Tags
+
+```bash
+$ pinpress tags -t 'tag1,tag2' -s 2014-01-01
+```
+
+...returns all tags that have been used *alongside* `tag1` and `tag2`, starting on Jarnuary 1, 2014.
+
+## Getting Tags Used Since Last Run
+
+Every time you run `pinpress tags`, the current date is added to `~/.pinpress`. Because of this, running:
+
+```bash
+$ pinpress tags last
+```
+
+...will get all the tags used since that date (e.g., if you'd last run `pinpress tags` on 2014-01-01, this command would return all tags used from 2014-01-02 onward).
+
# Templates
-The first stop on the PinPress journey is templates. Templates are used to define how data should be output and are defined in `~/.pinpress`. They come in two forms: **Pin Templates** and **Tag Templates**.
+Templates are used to define how data should be output to the terminal and are defined in `~/.pinpress`. They come in two forms: **Pin Templates** and **Tag Templates**.
## Pin Templates
Pin Templates define how a pin from Pinboard should be output.
### Schema
Pin Templates are placed under the `pin_templates` section of the `~/.pinpress` config file -- as an example:
-```YAML
+```yaml
pin_templates:
- name: pinpress_default
- opener: "<ul\n"
+ opener: "<ul>\n"
+ item: >
+ <li>
+ <b><a title="<%= description %>" href="<%= href %>" target="_blank">
+ <%= description %></a>.</b>
+ <%= extended %>
+ </li>
closer: "</ul>"
- item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
- description %></a>.</b> <%= extended %></li>\n"
```
A Pin Template can have several different sub-keys:
* `name` (**required**): the name of the template
@@ -116,75 +233,104 @@
### Usage
Pin Templates can be used in two ways: they can either be called dynamically:
-```
+```bash
$ pinpress pins template_name
```
...or a default template can be specified in `~/.pinpress`:
-```
+```yaml
---
pinpress:
config_location: "/Users/abach/.pinpress"
default_pin_template: pinpress_default
# ... other keys ...
pin_templates:
- name: pinpress_default
opener: "<ul>\n"
+ item: >
+ <li>
+ <b><a href="<%= href %>">
+ <%= description %></a>.</b>
+ <%= extended %>
+ </li>
closer: "</ul>"
- item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
- description %></a>.</b> <%= extended %></li>\N"
```
-The default template will be used when the `pins` command is run without any arguments:
+So, knowing the above, both:
-```
+```bash
$ pinpress pins
```
+...and:
+
+```bash
+$ pinpress pins pinpress_default
+```
+
+...will output pin data in the format specified by that template:
+
+```html
+<ul>
+ <li>
+ <b>
+ <a href="http://www.macstories.net/tutorials/launch-center-pro-guide/">
+ Automating iOS: A Comprehensive Guide to Launch Center Pro
+ </a>.
+ </b>
+ This the most amazing article I've seen in a long time. So many tips, tricks,
+ and automations to make productivity easier.
+ </li>
+ <!-- ... -->
+</ul>
+```
+
+(Note that the nice indenting is for Github's sake; the actual output will conform to the formatting in `~/.pinpress`.)
+
## Tag Templates
Tag Templates are exactly like Pin Templates, but are used for tags.
### Schema
They, too, are defined in `~/.pinpress`:
-```YAML
+```yaml
tag_templates:
- name: pinpress_default
item: "<%= tag %> (<%= count %>),"
```
-A Pin Template can have several different sub-keys:
+A Tag Template makes use of the same sub-keys as Pin Template:
* `name` (**required**): the name of the template
-* `opener` (*optional*): the text that should exist above the tags
-* `closer` (*optional*): the text that should exist below the tags
-* `item` (**required**): the formatted text that should be output for every pin
+* `opener` (*optional*): the text that should exist above the tag string
+* `closer` (*optional*): the text that should exist below the tag string
+* `item` (**required**): the formatted text that should be output for every tag
### Available Tokens
-Additionally, a Pin Template can make use of several different tokens that are filled by a pin's values:
+Additionally, like a Pin Template, a Tag Template can make use of a few tokens:
* `<%= tag %>`: the name of the tag
-* `<%= count %>`: the number of times the tag has been used in the range
+* `<%= count %>`: the number of times the tag has been used (depending on the range used)
### Usage
Pin Templates can be used in two ways: they can either be called dynamically:
-```
+```bash
$ pinpress tags template_name
```
...or a default template can be specified in `~/.pinpress`:
-```
+```yaml
---
pinpress:
config_location: "/Users/abach/.pinpress"
default_tag_template: pinpress_default
# ... other keys ...
@@ -193,150 +339,115 @@
tag_templates:
- name: pinpress_default
item: "<%= tag %> (<%= count %>),"
```
-Again, the default template will be used when the `tags` command is run without any arguments:
+So, knowing the above, both:
-```
+```bash
$ pinpress tags
```
-# Getting Pins
+...and:
+```bash
+$ pinpress tags pinpress_default
```
-$ pinpress pins
-# <ul>
-# <li>
-# <b><a title="Technical Debt, a case study : tags" href="http://marcgravell.blogspot.com/2014/04/technical-debt-case-study-tags.html?m=1" target="_blank">Technical Debt, a case study : tags</a>.</b> A look at how programmers solve complex problems iteratively.
-# </li>
-# <li>
-# <b><a title="Using Drafts for Remote CLI" href="https://gist.github.com/hiilppp/10993803" target="_blank">Using Drafts for Remote CLI</a>.</b> As a text file is added to a directory to which this AppleScript is associated as Folder Action, the content of the received file is executed as shell script and the generated output sent to an iOS device.
-# </li>
-# </ul>
-```
-This simple command will return all pins from the user's account and output them based on the [Pin Template](https://github.com/bachya/PinPress#pin-templates "Pin Templates") provided.
+...will output tag data in the format specified by that template:
-Pinpress also provides some flags that allow a user to define specific pins to grab:
-
-* `-s`: the start date to use (uses [Chronic](https://github.com/mojombo/chronic "Chronic"), which allows dates like "last Tuesday")
-* `-e`: the end date to use (also uses [Chronic](https://github.com/mojombo/chronic "Chronic"))
-* `-n`: the number of pins to return (e.g., 20)
-* `-t`: a CSV list of tags (e.g., "tag1,tag2") that must exist for the returned pins
-
-Naturally, these switches can be combined in any number of ways.
-
-## Getting Pins From a Date Forward
-
+```bash
+link-mash (15),app (2),ios (3),productivity (1),launch-center-pro (1),drafts (2),
```
-$ pinpress pins -s 2014-01-01
-```
-...returns all pins from January 1, 2014 to the current day.
+# Other Configuration Options
-## Getting Pins Until a Date
+You can place special keys in the `pinpress` section of `~/.pinpress` to automate some actions:
-```
-$ pinpress pins -e 2014-01-01
-```
+```yaml
+pinpress:
+ # ...other keys...
-...returns all pins up to January 1, 2014.
+ # The default `pins` template to use
+ default_pin_template
-## Getting Pins Between a Date Range
+ # The default `tags` template to use
+ default_tag_template
-```
-$ pinpress pins -s 2014-01-01 -e 2014-01-31
-```
+ # The default tags to be used when getting pins or associated tags
+ default_tags: ['tag1', 'tag2']
-## Getting Tagged Pins
+ # The tags to ignore when executing either `pins` or `tags`
+ ignored_tags: ['bad-tag', 'bad-tag2']
-```
-$ pinpress pins -t "ruby,cli"
-```
+ # The default number of results to return
+ default_num_results: 5
-...returns all pins tagged "ruby" *and* "cli".
-
-# Getting Tags
-
-Pinpress can also work with tags in a Pinboard account:
-
+ # ...other keys...
```
-$ pinpress tags
-# => cli (1),github (1),applescript (1),osx (1),link-mash (1),
-```
-This simple command will return all tags from the user's account and output them based on the [Tag Template](https://github.com/bachya/PinPress#tag-templates "Tag Templates") provided.
+Do note:
-Pinpress also provides some flags that allow a user to define specific tags to grab:
+* The `default_tags` key is overridden by the `-t` flag.
+* The `default_num_results` key is overridden by the `-n` flag.
-* `-s`: the start date to use (uses [Chronic](https://github.com/mojombo/chronic "Chronic"), which allows dates like "last Tuesday")
-* `-e`: the end date to use (also uses [Chronic](https://github.com/mojombo/chronic "Chronic"))
-* `-t`: a CSV list of tags (e.g., "tag1,tag2") to examine for association (see [below](#getting-tags-that-have-been-used-with-other-tags)).
+# Link Mash Config File
-## Getting Tags From a Date Forward
+For your reference, here's my `~/.pinpress` (which is used to generate a [Link Mash on my blog](http://www.bachyaproductions.com/tag/link-mash/ "Bachya Productions Link Mash Archives")):
-```
-$ pinpress tags -s 2014-01-01
-```
-
-...returns all tags used from January 1, 2014 to the current day. Note that for each tag returned, the data includes both the tag name and the number of times it was used.
-
-## Getting Tags Until a Date
-
-```
-$ pinpress tags -e 2014-01-01
-```
-
-...returns all tags used up to January 1, 2014.
-
-## Getting Tags Between a Date Range
-
-```
-$ pinpress tags -s 2014-01-01 -e 2014-01-31
-```
-
-## Getting Tags that Have Been Used With Other Tags
-
-```
-$ pinpress tags -t 'tag1,tag2' -s 2014-01-01
-```
-
-...returns all tags that have been used *alongside* `tag1` and `tag2`, starting on Jarnuary 1, 2014.
-
-# Other Configuration Options
-
-You can place special keys in the `pinpress` section of `~/.pinpress` to automate some actions:
-
-```YAML
+```yaml
+---
pinpress:
- # ...other keys...
- default_pin_template # The default `pins` template to use
- default_tag_template # The default `tags` template to use
- default_tags: ['tag1', 'tag2'] # The default tags to be used when getting pins or associated tags
- ignored_tags: ['bad-tag', 'bad-tag2'] # The tags to ignore when executing either `pins` or `tags`
- default_num_results: 5 # The default number of results to return
- # ...other keys...
+ config_location: "/Users/abach/.pinpress"
+ default_pin_template: pinpress_default
+ default_tag_template: pinpress_default
+ default_tags: ['link-mash']
+ ignored_tags: ['buffer']
+ log_level: WARN
+ version: 1.1.1
+ api_token: bachya:b819312cf9ccee799b87
+pin_templates:
+- name: pinpress_default
+ opener: >
+ <em>The weekly Link Mash is a curated selection of tools, stories, and
+ other links that I found during my travels on the web. All of my curated
+ links can be found onĀ <a title="Bachya's Pinboard: Link Mash"
+ href="https://pinboard.in/u:bachya/t:link-mash/" target="_blank">
+ my Pinboard</a>; you can also find the Link Mash archivesĀ <a
+ href="http://www.bachyaproductions.com/tag/link-mash/">here</a>.
+ </em>
+ <ul>
+ item: >
+ <li>
+ <b><a title="<%= description %>" href="<%= href %>" target="_blank">
+ <%= description %></a>.</b>
+ <%= extended %>
+ </li>
+ closer: >
+ </ul>
+ <hr/>
+ <em>This Link Mash was generated by <a title="PinPress"
+ href="https://github.com/bachya/pinpress" target="_blank">PinPress</a>,
+ a simple tool to generate text templates from <a title="Pinboard"
+ href="https://pinboard.in" target="_blank">Pinboard</a> data.</em>"
+tag_templates:
+- name: pinpress_default
+ item: "<%= tag %>,"
```
-Do note:
-
-* The `default_tags` key can be overridden by the `-t` flag.
-* The `default_num_results` key can be overridden by the `-n` flag.
-
# Known Issues & Future Releases
Check out the Pinpress roadmap via the [Trello Board](https://trello.com/b/lmuC8TT0/pinpress "Pinpress Trello Board").
Bugs, issues, and enhancement requests can be submitted on the [Issues Page](https://github.com/bachya/Pinpress/issues "Open Items").
# Bugs and Feature Requests
-To report bugs with or suggest features/changes for Sifttter Redux, please use the [Issues Page](http://github.com/bachya/PinPress/issues).
+To report bugs with or suggest features/changes for PinPress, please use the [Issues Page](http://github.com/bachya/PinPress/issues).
Contributions are welcome and encouraged. To contribute:
-* [Fork Sifttter Redux](http://github.com/bachya/PinPress/fork).
+* [Fork PinPress](http://github.com/bachya/PinPress/fork).
* Create a branch for your contribution (`git checkout -b new-feature`).
* Commit your changes (`git commit -am 'Added this new feature'`).
* Push to the branch (`git push origin new-feature`).
* Create a new [Pull Request](http://github.com/bachya/PinPress/compare/).