Sha256: 0c630ad152047740ecf067b6205d707567d8034cbb09bb91f845ae8d3d519c57

Contents?: true

Size: 710 Bytes

Versions: 3

Compression:

Stored size: 710 Bytes

Contents

#!/usr/bin/env ruby

require 'boop'

def print_usage!
  warn "Usage:"
  warn "  boop paste [NAME]"
  warn "  boop html [NAME]"
  warn
  warn "Saves the contents of stdin to ~/.boop and does a `git push`."
  exit 1
end

if ARGV.include?('--help') || ARGV.include?('-h') || ARGV.length > 2
  print_usage!
end

if ENV['BOOP_URL'].nil? || ENV['BOOP_URL'].empty?
  warn "Please define the BOOP_URL environment variable."
  warn "(Set it to the URL pastes will be located under.)"
  exit 1
end

command, name = ARGV[0..1]

# Default to text paste.
command ||= :paste

boop = Boop.new(ENV['BOOP_URL'], "~/.boop")

case command.to_sym
when :html, :paste
  boop.send(command, name, $stdin.read)
else
  print_usage!
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
boop-0.4.0 exe/boop
boop-0.3.0 exe/boop
boop-0.2.0 exe/boop