Skip to main content

Open a link with a command read from a database.

Project description

Pasterfu

Python program that opens a link with a command read from a database.

  • Link pasterfu with a program to make links from that program open into program of your choice.
  • Make your own rule database defining what link to open in what way

Made especially to use with RSS feed readers like newsboat. Or any other program where you might want to open a specific in a manner based on the link you are opening.

Requirements

  • Python 3.8 or newer
  • Pyperclip will be installed when installing pasterfu with pip
  • In Ubuntu sudo apt install python3
  • With Windows download and install Python 3
    • You could consider selecting Add Python to PATH during install

Install

  1. Install Python 3 - Requirements
  2. Run pip install pasterfu
  3. Create your config file rules. Configuration
    • For more info check Wiki Configuration
    • pasterfu will work with OS default browser even without configs

Linux

You propably need to use a command like:

pip3 install --upgrade pasterfu

Or:

python3 -m pip install --upgrade pasterfu

Windows

If you installed python without setting up path you need to include path when running pip.

py.exe -m pip install --upgrade pasterfu

Usage

pasterfu --link LINK

Replace the "LINK" with the link you wish to open. Check Wiki Usage for more info.

Windows

If you installed python without setting up path you need to include path when running pasterfu.

For Python 3.8: %LOCALAPPDATA%\Programs\Python\Python38\Scripts\pasterfu.exe --link LINK

Configurations

To see your current configurations pasterfu --config.

Set default browser of your choice pasterfu --config --edit 0 --input "firefox"

  • Default browser will be used if link to be opened has no match in database rules.

OS default internet browser will be used if no matching key is found.

Read more at Wiki Configuration.

Database

To see your current rules run pasterfu --db

Rules can be added/edited with pasterfu --db --edit 0 --input "https://www.twitch.tv/"

If --edit is given ID number that doesen't exist yet a new rule will be created.

Adding command valaues into rule: pasterfu --db --edit 0x0 --input "firefox"

Giving --edit 0x0 means in rule #0 command #0 --input "firefox"

Database file can be found in ~/.config/pasterfu.json. Or in %USERPROFILE%\Documents\pasterfu.json for Windows.

Example 1

Open link using the link argument.

pasterfu -l "https://gitlab.com"
Example 2

Open link piping into stdin.

echo "https://gitlab.com" | pasterfu
Example 3

Make rule to open gitlab pages.

pasterfu -d 0 "https://gitlab.com"
Example 4

Make rule to open rule #1 type links in Firefox:

`pasterfu -de 1x0 -i "firefox"`
Example 5

Set your default browser.

pasterfu -ce 0 "firefox"
Example 6

By using '%clip' you can copy a link with pyperclip.

pasterfu -de 1x0 -i "%copy"

Developing

TODO list found here Wiki TODO

Tests can be run with ./run_tests or run_tests.bat. These require flake8 and pytest. Both can be found in PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pasterfu-0.8.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

pasterfu-0.8.0-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file pasterfu-0.8.0.tar.gz.

File metadata

  • Download URL: pasterfu-0.8.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

File hashes

Hashes for pasterfu-0.8.0.tar.gz
Algorithm Hash digest
SHA256 9bee92dd4f626f03684d74ba0a199ea4ae723f37f69e5e202756162c3060abab
MD5 b0ce67eefe4d11faa45d4f60ea3d2c70
BLAKE2b-256 aa23700d04b85ed97eae9950320c16cd53599ee35c12df2618c4660ff7b11622

See more details on using hashes here.

File details

Details for the file pasterfu-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: pasterfu-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 24.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

File hashes

Hashes for pasterfu-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e217b156018679aff01f85fec9a2a0fb9d23b5f4ab6c5afe761739dea799045a
MD5 c0a77c76bd420ed5b12ba339e82711ee
BLAKE2b-256 80b260e1a58067df99aa391571da6a32e18529cfb192a1de056873dfdce86b8d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page