💼 CLI / TUI for Pocket
A simple CLI (or TUI) for Pocket.
Gocket is in early version. Its interface might change. See the CHANGELOG
You can simply grab the latest binary file and download the version you need, depending on your OS.
If you use a Linux-based OS, here's a simple way to download gocket and move it to /usr/local/bin
. You can then call it wherever you want.
curl -L https://raw.githubusercontent.com/Phantas0s/gocket/master/install/linux.sh | bash
go build
.You need to authorize gocket to access your Pocket account. It's very easy:
-k
option) or you can use a config file:
$XDG_CONFIG_HOME/gocket/config.yml
key
as index and the consumer key as value, for example key: 1234-5a6b7c
Running gocket list
without any consumer key will display an error message indicating where to create the config file.
The value of $XDG_CONFIG_HOME
depends of your OS. Here are the defaults (if you didn't modify it):
~/.config
~/Library/Application Support
%LOCALAPPDATA%
Use the option -h
for each command to output the help.
gocket list
: list your Pocket pages.gocket list archive
: list the archives.The options for these two commands are almost identical. Here are the difference:
-a
with gocket list
to bulk add every listed entry to the archive (with confirmation).-a
with gocket list archive
to bulk add every listed archive to the unread list (with confirmation).gocket add <URLs...>
: Add the URLs <URLs....>
to pocket. You can add multiple URLs separated with spaces.This command will read the standard input stream (stdin) if no argument is given. For example:
echo "https://thevaluable.dev" | gocket add
If you want to display a message when each URL is successfully added, use the option verbose (-v
).
If you choose to use the TUI, you can select a page and open it with your favorite browser using the ENTER
key.
Description | Command |
---|---|
Output every page's URLs | gocket list |
Display every page's URLs in a TUI | gocket list --tui |
Output the last 5 pages' URLs added | gocket list -c 5 |
Display pages in a TUI and don't ask confirmation for any operation | gocket list -c 5 --tui --noconfirm |
Filter for type 'video' ('article' or 'image' possible too) | gocket list -f "video" |
Search for "youtube" in titles and URLs | gocket list -s "golang" |
Open the last page added with Firefox | gocket list -c 1 | xargs firefox |
Open the last page added with Lynx | gocket list -c 1 | lynx - |
Open the oldest page added with Firefox | gocket list -c 1 -o "oldest" | xargs firefox |
Open the last 5 pages added with Firefox and archive them | gocket list -c 5 -a --noconfirm | xargs firefox |
Open the last page added with Firefox and delete it | gocket list -c 1 -d --noconfirm | xargs firefox |
Print only the pages' titles | gocket list -c 10 -t | sed 'n;d' |
As a bonus for Linux users (might work on macOS too), you can use fzf to fuzzy search the page you want and open it with Firefox:
gocket list -c 5 -t | sed 'N;s#\n# /// #' | fzf | awk -F ' /// ' '{print $2}' | xargs firefox
You can provide the different options to gocket using:
gocket list --tui
)export GOCKET_TUI=true
)tui: true
in $XDG_CONFIG_HOME/gocket/config.yaml|json|toml
)If these options are defined multiple times, the priorities follow the order above (from higher priority to lower).
The names of the environment variables need to be uppercase and prefixed with GOCKET_
. Every hyphen -
in the option's name needs to be replaced with an underscore _
.
↑ or k: up ↓ or j: down PgUp or CTRL+u: One screen up PgDn or CTRL+d: One screen down Home or g: Top of the list End or G: Bottom of the list
ENTER: Open the selected page with your favorite browser d: Delete Pocket entry a: Add (if list archive) or archive (if list unread)
Consider sponsoring my work if you want to see new, fresh, and crunchy little CLIs (and TUIs) all over your system.
Switching between a keyboard and mouse costs cognitive energy. My book will help you set up a Linux-based development environment that keeps your hands on your keyboard. Take the brain power you've been using to juggle input devices and focus it where it belongs: on the things you create.
You'll learn how to write your own installation scripts too!