upaste

After a brief and torrid affair with Fedora, I gave up and threw Ubuntu 10.04 on my home desktop. One thing that I missed from Fedora was the fpaste utility. This handy little command-line tool lets you paste the results of your shell commands to fpaste.org, a semi-official Fedora pastebin.

After realizing that pastebin.com had an open API, I took it upon myself to write a little Python script that could submit pastes for me.

And so I give you upaste (u for Ubuntu, but it can run on any *nix flavor, including OS X). Please try it out and give me your thoughts. I hope someone will find it useful.

Installing

Download the source from bitbucket.

# Copy the upaste file somewhere in your $PATH
$ sudo cp upaste /usr/local/bin/
 
# Then run!
$ ifconfig | upaste
 
# -h is for help
$ upaste -h
Usage: upaste [options]
  Posts a file to http://pastebin.com/ and returns the URL.
  If no file arguments are given, input is expected on stdin.
 
Options:
  --version           show program's version number and exit
  -h, --help          show this help message and exit
  -p, --private       mark your paste private.
  -f FILENAME         filename whose contents you wish to paste.
  -n PASTE_NAME       add your name or a title to paste.
  -e PASTE_EMAIL      send a confirmation email with paste link.
  -s PASTE_SUBDOMAIN  use a pastebin subdomain.
  -x PASTE_EXPIRE     set paste expiration: N = Never, 10M = 10 Minutes, 1H =
                      1 Hour, 1D = 1 Day (default), 1M = 1 Month.
  -l PASTE_FORMAT     define the default syntax highlighting for your paste.