Arch manual pages

PBPST(1) pbpst PBPST(1)

NAME

pbpst - A simple libcurl/C pastebin utility for pb deployments

SYNOPSIS

pbpst <operation> [options]

DESCRIPTION

pbpst is a command-line libcurl C client for pb, a lightweight pastebin.

OPERATIONS

-S, --sync
Create a paste.
-s,--shorten=URL
Create a redirect to URL.
-R, --remove
Delete a paste.
-U, --update
Update a paste.
-D, --database
Interact with the local database.

GLOBAL OPTIONS

The following options are available for any operation.
-h, --help
Print usage information and exit.
-P,--provider=HOST
Use HOST as pb provider; default is https://ptpb.pw.
-b,--dbpath=PATH
Specify a file to use as the local database.
--verbose
Passing once will output the full response from pb in valid yaml (including the URL we create with modifications specified by the user). Passing twice will signal libcurl to output verbosely as well.
--version
List the version and exit.
--list-lexers
List the pygments lexers supported by the pb provider and exit.
--list-themes
List the pygments themes supported by the pb provider and exit.
--list-formats
List the pygments formatters supported by the pb provider and exit.

SYNC OPTIONS

Note: if the -f option is not passed, pbpst will paste the contents of stdin.
-f,--file=FILE
Create a paste from FILE.
-l,--lexer=LANG
Lex paste with LANG.
-T,--theme=THEME
Style paste using the pygments theme THEME.
-e,--extension=EXT
Specify the MIME-type of the file as EXT.
-L,--line=LINE
Highlight LINE in paste.
-F,--format=FORM
Format paste using the pygments format FORM.
-p, --private
Return a less-guessable Id for paste.
-x,--sunset=TIME
Set the paste to expire automatically in TIME. You can specify a unit for TIME: d(ays), h(ours), m(inutes) or s(econds). Note that d, h and m are just shortcut multipliers ( 1d is equivalent to 86400s); pbpst makes no attempt to handle leap seconds or timezones. If you specify no unit, "seconds" is assumed.
-r, --render
Render a ReStructuredText or Markdown paste to HTML.
-t, --term
Handle Asciinema videos.
-v,--vanity=NAME
Use NAME as a custom Id.

-#, --progress
Show a progress bar for the status of the upload.

-m,--message=STR
Store STR as a message with the paste in the local database (helpful for reminding you what the contents of the paste are).

REMOVE OPTIONS

-u,--uuid=UUID
Delete (local and upstream) paste identified by UUID.
-y, --prune
Delete (local and upstream) all expired pastes. Equivalent to running -Ru for each paste with a sunset time older than time at run-time.

UPDATE OPTIONS

Note: if the -f option is not passed, pbpst will paste the contents of stdin.
-f,--file=FILE
Use FILE for content of paste.
-l,--lexer=LANG
Lex paste with LANG.
-T,--theme=THEME
Style paste using the pygments theme THEME.
-e,--extension=EXT
Specify the MIME-type of the file as EXT.
-L,--line=LINE
Highlight LINE.
-F,--format=FORM
Format paste using the pygments format FORM.
-r, --render
Render a ReStructuredText or Markdown paste to HTML.
-t, --term
Handle Asciinema videos.
-x,--sunset=TIME
Set the paste to expire automatically in TIME. You can specify a unit for TIME: d(ays), h(ours), m(inutes) or s(econds). Note that d, h and m are just shortcut multipliers ( 1d is equivalent to 86400s); pbpst makes no attempt to handle leap seconds or timezones. If you specify no unit, "seconds" is assumed.
-u,--uuid=UUID
Use UUID as authentication credential.

-#, --progress
Show a progress bar for the status of the upload.

-m,--message=STR
Store STR as a message with the paste in the local database (helpful for reminding you what the contents of the paste are).

DATABASE OPTIONS

-i, --init
Initialize the database with a default provider and a pastes object, and exit.
-H, --providers
List all providers currently in the database (one per line).
-q,--query=STR
Search each paste in the pastes object for text matching STR. Matches will be printed to stdout with the form <uuid>\t<provider>/<id>\t<msg>\t<sunset> where <id> is either the long id or a vanity label if one exists.
-d,--delete=UUID
Remove (locally) the paste from the pastes object specified by UUID. Note: This option will respect the default provider and the -P option.
--set-default
When using this option, you must also specify the -P option. Sets the specified provider to be pbpst's new default provider.
-y, --prune
Remove all expired paste entries from the local database. Equivalent to running -Dd for each paste with a sunset time older than time at run-time.

EXAMPLES

pbpst -Sf <filepath> -x 5m
paste the file at <filepath> which will expire in 300 seconds.
pbpst -s <url>
create a shortcut URL to <url>
pbpst -Ru <UUID>
remove a paste using <UUID> for authentication
pbpst -Uu <UUID> -f <filepath>
update a paste to the file at <filepath> using <UUID> for authentication
for i in $(pbpst -DH) ; do pbpst -Dq '<search>' -P $i ; done
search for a paste matching <search> regardless of provider
gpg -o - -c <filepath> | pbpst -S
encrypt file at <filepath> with GPG symmetric cipher and paste it which can be retrieved and decrypted using curl <pasteurl> | gpg -d

ERRORS

pbpst does everything within its power to make sure that user data is preserved wherever possible. Much of its design follows this principle (for example, this is why there is a swap database). This means that if it ever sees something go wrong during execution, it tries to fail out in a way that is most likely to preserve user data.
 
As a result, if something goes wrong and pbpst determines it needs to fail out, it may decide to not remove the swap db in case it contains data relevant to the user that needs to be manually merged into the main database. However, sometimes, pbpst may fail out and choose to not clean up the swap db, but the swap db will be empty. This case triggers a contingency where pbpst will detect the empty swap db and clean it up anyway.

BUGS

Report bugs for pbpst to https://github.com/HalosGhost/pbpst/issues

FILES

$XDG_CONFIG_HOME/pbpst/db.json $HOME/.config/pbpst/db.json
One of the two files above contains the lone config option for pbpst along with the database of pastes. If $XDG_CONFIG_HOME is not defined, the second path will be used as a fallback.


 
$XDG_CONFIG_HOME/pbpst/.db.json.swp $HOME/.config/pbpst/.db.json.swp
One of the two files above contains a copy of the paste database which is used while pbpst is running (it is used to try to minimize the possibility of data-loss). It will be located in the same directory as the live database.


SEE ALSO

libcurl(3), pbpst_db(5)
 
See the documentation on pb, a lightweight pastebin at https://github.com/ptpb/pb/blob/master/pb/templates/index.rst
13 Nov 2016