Skip to content

Commit

Permalink
Preparing for 2.1.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
ttscoff committed May 29, 2023
1 parent d039823 commit e489077
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 24 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 2.1.1

## 2.0.48

#### NEW
Expand Down
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
![Howzit banner image](https://cdn3.brettterpstra.com/uploads/2022/08/gatherheader-rb.webp)
# Gather CLI

![Howzit banner image](https://cdn3.brettterpstra.com/uploads/2022/08/gatherheader-rb.webp)

Current version: 2.0.48

Current version: 2.1.1

This project is the successor to read2text, which was a Python based tool that used Arc90 Readability and html2text to convert web URLs to Markdown documents, ready to store in your notes. It takes its name from another of my similar projects that I've since retired. It was this, but with a GUI, and this is infinitely more scriptable and is designed to nestle into your favorite tools and projects.

Expand Down Expand Up @@ -35,7 +36,7 @@ cd gather-cli
swift build -c release
```

The gather binary will be located in `.build/release/gather`. Copy it wherever you keep your binaries in your `PATH`.
The gather binary will be located in `.build/release/gather`. Copy it wherever you keep your binaries in your PATH.

Or... just run `make install`, which will build the release version and copy it to `/usr/local/bin`.

Expand All @@ -45,7 +46,7 @@ Or... just run `make install`, which will build the release version and copy it
[Download the latest PKG installer](https://github.com/ttscoff/gather-cli/releases/latest)


Double click to run the installer. This will install gather to `/usr/local/bin` with root permissions.
Double click to run the installer. This will install gather to /usr/local/bin with root permissions.

### Usage

Expand Down Expand Up @@ -106,7 +107,7 @@ You can also pass raw HTML to Gather and have it perform its magic on the source

If you specify the `--html` and `--paste` flags, Gather will first check your HTML pasteboard for content. This means that if you've copied by selecting text on a web page or any web view, Gather can operate on that "rich text" version. If you've copied plain text source, that pasteboard will be empty and Gather will fall back to using the plain text pasteboard.

You can also pull a URL or HTML from an environment variable using `--env VARIABLE`. This is mainly for incorporation into things like PopClip, which passes HTML via the `$POPCLIP_HTML` variable.
You can also pull a URL or HTML from an environment variable using `--env VARIABLE`. This is mainly for incorporation into things like PopClip, which passes HTML via the $POPCLIP_HTML variable.

#### Output Options

Expand All @@ -126,7 +127,7 @@ By default Gather will maintain Unicode characters in the output. If you'd prefe

`--include-source` will add a `[Source](PAGE_URL)` link to the top of the document. You can disable this link with `--no-include-source`. You can also include MultiMarkdown or YAML metadata with source URL, capture date, and page title using `--metadata` or `--metadata-yaml`.

`--include-title` will attempt to insert an H1 title if the output doesn't have one. If a title can be determined and a matching H1 doesn't exist, it will be added at the top of the document. This is handy when the page has its header (and headline) outside of the content area that Readability chooses as the main block, and the option defaults to true. `--no-include-title` will disable this, but it will not remove an existing h1 from the document.
`--include-title` will attempt to insert an H1 title if the output doesn't have one. If a title can be determined and a matching h1 doesn't exist, it will be added at the top of the document. This is handy when the page has its header (and headline) outside of the content area that Readability chooses as the main block, and the option defaults to true. `--no-include-title` will disable this, but it will not remove an existing h1 from the document.

If you just want to get the title of a URL, use `--title-only` to output a plain text title with no decoration.

Expand All @@ -140,37 +141,37 @@ To save only the accepted answer (if there is one) for a question, use `--accept

Comments can often be fruitful (and important) to an answer, but they also get messy on popular posts, so they're ignored by default. To include comments when saving a StackExchange page, just add `--include-comments`.

Lastly, sometimes there's more than one good answer worth saving, but a bunch of zero-vote errors in judgement you don't need in your notes. Use `--min-upvotes X` to filter answers by a minimum number of upvotes. For example, `--min-upvotes 60` would easily weed out the less-desirable answers on an older question. Filtering by upvotes does not affect the accepted answer; if one exists, it's included no matter how many upvotes is has (or doesn't have).
Lastly, sometimes there's more than one good answer worth saving, but a bunch of zero-vote errors in judgement you don't need in your notes. Use `--min-upvotes X` to filter answers by a minimum number of upvotes. For example, `--min-upvotes 60` would easily weed out the less-desirable answers on an older question. Filtering by upvotes does not affect the accepted answer, if that exists it's included no matter how many upvotes is has (or doesn't have).

#### nvUltra/nvALT Options

If you're running nvUltra, you can output clipped web pages directly to a notebook.

`--nvu-url` will generate a `x-nvultra://make` URL that, when opened, will add the markdown version of the web page as a note, titled with the page title. This flag simply outputs the url (or copies it with `--copy`) and can be used as part of another script that handles the link.
`--nvu-url` will generate a x-nvultra://make url that, when opened, will add the markdown version of the web page as a note, titled with the page title. This flag simply outputs the url (or copies it with `--copy`) and can be used as part of another script that handles the link.

`--nvu-add` will immediately open the URL and add your note to nvUltra.
`--nvu-add` will immediately open the url and add your note to nvUltra.

You can include a `--nvu-notebook PATH` option to specify which notebook the note gets added to. If this is left out, the note will be added to the frontmost open notebook in nvUltra.

[Here's a Shortcut](https://github.com/ttscoff/gather-cli/raw/main/extras/Gather%20to%20nvUltra.shortcut) that accepts text or URLs and runs `gather --nv-add` on them. I trigger it with LaunchBar to send the current page from my browser straight to nvUltra.

The `url` and `add` options work with just `--nv` instead of `--nvu` to generate an `nv://` URL that will work with Notational Velocity or nvALT.
The `url` and `add` options work with just `--nv` instead of `--nvu` to generate an `nv://` url that will work with Notational Velocity or nvALT.

#### Other URL handlers

You can generate any kind of url scheme you want using `--url-template`. This is a string that can contain the following placeholders (all URL encoded):

- `%title`: The title of the page
- `%text`: The markdown text of the page
- `%notebook`: The contents of the `--nvu-notebook` option, can be used for additional meta in another key
- `%source`: The canonical URL of the captured page, if available
- `%date`: Today's date and time in the format `YYYY-mm-dd HH:MM`
- `%filename`: The title of the page sanitized for use as a file name
- `%slug`: The title of the page lowercased, all punctuation and spaces replaced with dashes (`using-gather-as-a-web-clipper`)
- %title: The title of the page
- %text: The markdown text of the page
- %notebook: The contents of the `--nvu-notebook` option, can be used for additional meta in another key
- %source: The canonical URL of the captured page, if available
- %date: Today's date and time in the format YYYY-mm-dd HH:MM
- %filename: The title of the page sanitized for use as a file name
- %slug: The title of the page lowercased, all punctuation and spaces replaced with dashes (`using-gather-as-a-web-clipper`)

You can include a fallback title using `--fallback-title "TITLE"`. If a page title can't be determined (common when running on snippets of HTML), this variable will be inserted. You can include the `%date` placeholder, which will be replaced with an ISO datetime.
You can include a fallback title using `--fallback-title "TITLE"`. If a page title can't be determined (common when running on snippets of HTML), this variable will be inserted. You can include the "%date" placeholder, which will be replaced with an ISO datetime.

To show nvUltra's URL scheme in this manner:
To show nvUltra's url scheme in this manner:

--url-template "x-nvultra://make/?txt=%text&title=%filename&notebook=%notebook"

Expand Down
2 changes: 1 addition & 1 deletion Sources/gather/gather.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Foundation
import HTML2Text
import Readability
import Yams
var VERSION = "2.1.0"
var VERSION = "2.1.1"

var acceptedAnswerOnly = false
var disableReadability = false
Expand Down
Binary file modified buildnotes.md.secret
Binary file not shown.
6 changes: 3 additions & 3 deletions scripts/bump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

mainfile = ARGV[0]
new_version = ARGV[1]
src = ARGV[2] # 'src/_README.md'
dest = ARGV[3] # 'README.md'

content = IO.read(mainfile)
content.sub!(/(?mi)(?<=var VERSION = ")(.*?)(?=")/, new_version)
File.open(mainfile, 'w') { |f| f.puts content }

src = 'src/README.md'
dest = 'README.md'

readme = IO.read(src).force_encoding('ASCII-8BIT').encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')

content = readme.match(/(?<=\<!--README-->)(.*?)(?=\<!--END README-->)/m)[0]
Expand Down
2 changes: 1 addition & 1 deletion scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ notarizefile() { # $1: path to file to notarize, $2: identifier

xcrun swift build -c release --arch arm64 --arch x86_64
bindir=$(xcrun swift build -c release --arch arm64 --arch x86_64 --show-bin-path)
codesign --force --verbose --sign 'Developer ID Application: Brett Terpstra' -o runtime --timestamp $bindir/$executable
codesign --force --verbose --sign 'Developer ID Application: Brett Terpstra (47TRS7H4BH)' -o runtime --timestamp $bindir/$executable
codesign --verify -vvvv $bindir/$executable
rm -rf package
mkdir -p package/usr/local/bin
Expand Down

0 comments on commit e489077

Please sign in to comment.