Sha256: ae628f21893d48761c0af77ea27522a037355ec61e37654da7ed24c67f3b2f60

Contents?: true

Size: 704 Bytes

Versions: 1

Compression:

Stored size: 704 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
when :html, :paste
  boop.send(command, name, $stdin.read)
else
  print_usage!
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
boop-0.1.0 exe/boop