Giter VIP home page Giter VIP logo

pb_cli's Introduction

pb_cli

pb_cli is a no bullshit pb client.

installation

An install script is provided for convenience.

$ curl -Lo- "https://raw.githubusercontent.com/ptpb/pb_cli/master/install.sh" | sudo bash

This is just a handful of trivial commands to install pb in /usr/local/bin. Feel free to copy-paste instead if you wish.

dependencies

Dependencies are not considered during installation; you need to make these exist on your own.

  • curl
  • bash>4.0
  • jq
  • capture (optional, for screen capture)
  • maim (optional, for screenshots)
  • xclip (optional, for clipboard manipulation)

usage

Maximum simple:

$ pb <<< 'hello world'
https://ptpb.pw/DtUR

The url is provided on stdout to make pb easy to use in pipelines/scripting.

files

If you don't have the PhD in bash like #bash presumes, this might not be obvious to you:

pb < /path/to/my/file

private

Create a "private" paste (disables short url).

pb private

screenshot

This uses maim to create a screenshot. You can either click-drag a bounding box for a region, or click a window for the entire window.

pb png

screen capture

This uses capture to create a screen capture, convert to webm or gif, and upload to pb. Usage is very similar to pb png--both use slop for window/region selection.

pb webm
pb gif

When you are done, press q once to stop recording.

clipboard

When set, by default, PB_CLIPBOARD will put the paste url in the X11 primary buffer. You can modify this behavior by setting PB_CLIPBOARD_TOOL, possibly with additional arguments.

PB_CLIPBOARD=1 pb …

For usability, you'll likely want to export this variable in your shell rc file if this is a feature you want to use regularly.

advanced usage

If you have more complex scripting needs (like capturing the uuid for updates/deletes), you can use the PB_JSON environment variables to get the raw json:

$ PB_JSON='.' pb <<< test
{
  "status": "already exists",
  "url": "https://ptpb.pw/f5-D",
  "short": "f5-D",
  "size": 5,
  "long": "AE4SQ70ixm52wrqe3cH5E5Tlf5-D",
  "date": "2015-02-28T14:45:23.444000+00:00",
  "digest": "4e1243bd22c66e76c2ba9eddc1f91394e57f9f83"
}

So, for example:

$ eval "$(PB_JSON='.' pb <<< test | jq -r '@sh "url=\(.url) short=\(.short)"')"
$ echo $short
f5-D
$ echo $url
https://ptpb.pw/f5-D

pb_cli's People

Contributors

buhman avatar oliverralbertini avatar

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.