Skip to main content

A small python cli to manage paste.lol from cli

Project description

lolbin

A command-line interface tool for managing pastes on paste.lol, a service of omg.lol.
It does only that but it does it well.

WARNING: Remember that every past on paste.lol is public. If you have the URL of the paste, you can fetch it without authentication.

You can access every listed paste of someone on the web at "https://paste.lol/

". Mines are here: https://paste.lol/ache.

Table of Contents

Features

  • Create/Update Paste - Allows you to create or update a paste with a specified title and content.
  • List Pastes - Lists all your pastes along with their titles and the time they were last modified.
  • Show Paste - Displays the content of a specific paste by its title.
  • Delete Paste - Deletes a specific paste by its title.
  • Help Message - Provides usage instructions for the tool.
  • Debug Mode - Prints the action to be performed, the paste name, address, and bearer token (but does not actually perform the action).

Very quick use

  • List Pastes - lolbin
  • List public Pastes- lolbin -P
  • Show Paste - lolbin paste-name
  • Create paste - echo 'My paste' | lolbin paste-name (will also replace a paste).
  • Create listed paste - echo 'My paste' | lolbin paste-name -L
  • Edit paste - lolbin -e paste-nameP
  • Delete Paste - lolbin -d paste-name

Installation

To install the tool, you can use pip:

$ pip install lolbin

But the recommanded way is via pipx:

$ pipx install lolbin

You can run it with uv:

$ uv run lolbin

On Arch Linux, there is a package on the AUR, so use your prefered AUR packages manager, mine is yay:

$ yay -S lolbin

Configuration

To configure the tool, create a file ~/.config/lolbin/config.toml with the following content:

address = "your_address"
bearer_token = "your_bearer_token"

You can obtain a bearer token by logging in to the <omg.lol> website, in you account, at the end of the page, section 'API Key'.

If you don't want to store you API token inside a config file, you can call external command to retrieve it from you secret manager.

With the backtick syntax for command substitution:

address = "your_address"
bearer_token = "`bws secret get XXXXXX` | jq .key --raw-output"

Or with the dollard based one:

address = "your_address"
bearer_token = "$ pass api.omg.lol/token_lolbin"

Examples of Use

  1. To create/update a paste:

    $ echo "My awesome content" | lolbin --paste my_awesome_paste
    

    If you want to paste content from a file, use the --file flag:

    $ echo "My awesome content" > my_content.txt
    $ lolbin --paste --file my_content.txt my_awesome_paste
    

    The --past part is optional, as lolbin can deduct the action from the input.

    $ cat my_content.txt | lolbin --paste my_awesome_paste
    

    For obvious reasons, by default a past is private (aka non-listed, remember every past is exposed on the public web), to make it public (aka listed in the paste.lol jargon) use the "--public" (or "-P") option.

    $ echo "This is public !" | lolbin public-message -P
    

    I know that "-P" can be confused with "private", the idea is that, by default it's private so you don't need a private option. If you find it confusing, you can also use the paste.lol jargon with "--listed" (and "-L").

  2. To list your pastes:

    $ lolbin --list
     - my_awesome_paste (10s ago)
    

    List is the default action so you can also ommit the --list.

    Also, by default, it only list all the paste, so the private one too (aka non-listed). To list only the public paste (aka listed in the paste.lol jargon), use the "--public" option (or "-P", or "--listed" and "-L").

    It's conveniant to remember that "-l" is for private and "-L" will list every paste.

    $ lolbin -l
     - my_awesome_listed_paste (30s ago)
     - my-awesome-private-paste (1min ago)
    $ lolbin -L
     - my_awesome_listed_paste (33s ago)
    
  3. To show the content of a specific paste:

    $ lolbin --show my_awesome_paste
    My awesome content
    

    As with the --paste option, lolbin can deduct the action without the --show option.

    $ lolbin my_awesome_paste
    My awesome content
    
  4. To delete a specific paste:

    $ lolbin --delete my_awesome_paste
    

    Or use the -d short option.

  5. To edit a specific paste:

    $ lolbin --edit my_awesome_paste
    

    The editor will be opened with the content of the paste. The content will be replaced with the edited content. The editor is determined by the EDITOR environment variable. If it is not set, the vim is used.

  6. For help:

    $ lolbin --help
    
  7. To run in debug mode, use the --debug flag with any command:

    $ lolbin --debug --list
    

    It will not do anything.

Similar projects

  • clilol: A CLI that support all the APIs of omg.lol. But too inconvenient to use for me for paste, ideal for status.
  • Pastol: A CLI for paste.lol. Nice and in Rust ! 🦀. But again, it lakes some usefull features like retrieve the API token from a manager. But have some others nice features. (search ! And a nice UI to show a paste).
  • omglolcli: A CLI that support some of the APIs of omg.lol. Nice but incomplet.

License

lolbin is distributed under the terms of the MIT license.

Requirements

  • Python 3.10 or higher, Python syntax
  • requests library, for HTTP requests to the api.omg.lol API.
  • tomli library, for configuration

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

lolbin-2.0.1.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lolbin-2.0.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file lolbin-2.0.1.tar.gz.

File metadata

  • Download URL: lolbin-2.0.1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.14.5 HTTPX/0.28.1

File hashes

Hashes for lolbin-2.0.1.tar.gz
Algorithm Hash digest
SHA256 7e513e5774ae4d01d90f8576f3392377ac90d95af4a668849c9d84813d240944
MD5 c60bcf486e455ad2d3918bc4985fbfb6
BLAKE2b-256 47122073bff6fe0fcec65715c5a41392f883715d43cbc335fbb4b8c0b290defa

See more details on using hashes here.

File details

Details for the file lolbin-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: lolbin-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.14.5 HTTPX/0.28.1

File hashes

Hashes for lolbin-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ff0c90a71af1aa3a6e94bf3ac9ffc30178001c7cb61f84ee565593ba0bb888d5
MD5 e98cdb22a9a241406af7237c41cc078e
BLAKE2b-256 1587ea498a16ecd581fe0ef0c955e0200a9dc3938ed73ccdf4ea1324a6ee280e

See more details on using hashes here.

Supported by

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