Coder Social home page Coder Social logo

pinboard.zsh's Introduction

Pinboard.zsh (w/ Qutebrowser userscript support)

A simple ZSH script for adding URLs to Pinboard via CLI.

With support for functioning as a Qutebrowser userscript, create a keyboard short to save the current page to Pinboard.

See also: instapaper.zsh for a similar script for adding articles to Instapaper via ZSH and Qutebrowser.

Installation

a) Install zsh and curl if not yet installed

b) Copy pinboard script to a local bin directory or run the installer

$ git clone https://github.com/t1mxg0d/pinboard.zsh
$ cd pinboard.zsh
$ chmod +x install
$ ./install

c) Export your API token to your shell enviornment:

export PINBOARD_API_TOKEN="<username:apitoken>"

Visit https://pinboard.in/settings/password to find your API token.

Usage

To add a URL to pinboard just run:

$ pinboard add <url>

For example:

$ pinboard add https://github.com/t1mxg0d/pinboard.zsh/master/README.md
> Pinboard - Saving: https://github.com/t1mxg0d/pinboard.z....
> Pinboard - Article saved! {bookmark_id: 732753757}

Qutebrowser userscript

Symlink pinboard bin installed above to ~/.local/share/qutebrowser/userscripts/ and make executable:

$ ln -sf ~/.bin/pinboard ~/.local/share/qutebrowser/userscripts/pinboard

Test it out by running:

:spawn --userscript pinboard qute-add

Add a keyboard shortcut by opening ~/.config/qutebrowser/keys.conf

vim +437 ~/.config/qutebrowser/keys.conf

and copying this into the [normal] section (line 47-437).

spawn -u pinboard qute-add
    sP

Now open Qutebrowser and test out the keyboard shortcut. You can change sI so whatever keyboard shortcut you like.

TODO

  • Add support for tagging articles from Qutebrowser
  • Test on OSX/Windows

Enjoy!, t1mxg0d

Licence: GPL v3

pinboard.zsh's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

nedludd

pinboard.zsh's Issues

Some information on implementing on MacOS

I got this working on MacOS, and I wanted to share how, for other people who might be looking.

First step, not a problem with this script: qutebrowser needs to be able to call spawn correctly, which it can't by default on MacOS. see this issue for details on the problem and how to get around it. I'm solving this by launching from a terminal window, the other solutions listed there should work just as well.

Second thing, which is possibly an issue with this script: when trying to save I got the error

 Pinboard - Bookmark saved ERROR: API_PATH must be an HTTP `/path` currently: https://api.pinboard.in/v1/posts/add

Clearly, the path is in fact an http path, and I don't understand why the check there is failing (I tried with both http and https variants and got the same error). I commented out the lines that do this check (lines 68 and 69 at present), and the script seems to work fine (in limited testing) with no errors. I'm certain there is a more sustainable way of solving this problem within the script that is beyond my current knowledge.

Hope this helps someone!

@dmix feel free to include this information in the README or anywhere else if you would like.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.