Skip to content

sent-hil/pinboard-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Pinboard Bookmark CLI

A simple command-line tool for saving bookmarks to Pinboard. Generated by Claude.

Features

  • Automatically fetches the page title before saving the bookmark.

Installation

Prerequisites

  • Go 1.16 or higher
  • A Pinboard account and API token

Install with Go

# Clone this repository
git clone https://github.com/sent-hil/pinboard-cli
cd pinboard-cli

# Build the binary
go build -o pinboard-cli

# Move to a directory in your PATH (optional)
sudo mv pinboard-cli /usr/local/bin/

Configuration

You need to set your Pinboard API token as an environment variable.

For Fish shell users

Set the environment variable for your current session:

set -x PINBOARD_API_TOKEN "username:TOKEN"

Add it to your Fish config for persistence:

# Add this line to ~/.config/fish/config.fish
set -gx PINBOARD_API_TOKEN "username:TOKEN"

Replace username:TOKEN with your actual Pinboard username and API token, which you can find in your Pinboard settings under "password" tab.

Usage

pinboard-cli https://example.com

pinboard-cli --tags="programming,golang,cli" https://example.com

# Provide a custom title/description (skips automatic title fetching)
pinboard-cli --desc="My Custom Title" https://example.com

Title Cleaning Rules

The tool automatically cleans titles from certain websites to remove common prefixes/suffixes. Built-in rules include GitHub repository titles. Custom Title Rules You can create a title_rules.json file in the same directory as the executable to add your own title cleaning rules:

[
  {
    "host_pattern": "github.com",
    "title_pattern": "^GitHub - [^:]+: (.+)$",
    "replacement": "$1"
  },
  {
    "host_pattern": "arxiv.org",
    "title_pattern": "^\\[[0-9.]+\\] (.+)$",
    "replacement": "$1"
  }
]

Each rule consists of:

  • host_pattern: A string that should be in the URL host
  • `title_pattern``: A regular expression to match against the title
  • replacement: The replacement pattern (can use regex capture groups)

Troubleshooting

If you see an error about the API token:

Error: PINBOARD_API_TOKEN environment variable not set

Make sure you've set the environment variable correctly:

set -x PINBOARD_API_TOKEN "username:TOKEN"
echo $PINBOARD_API_TOKEN  # Verify it's set correctly

License

MIT

About

Save to Pinboard from CLI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages