#!/usr/bin/env ruby
Signal.trap(:INT){ abort "\n(interrupted by SIGINT)" }
paste = ARGF.read
puts "paste size: #{paste.size}"
require_relative "../lib/paster"
paster = Paster paste
require "tty-prompt"
paster = begin
TTY::Prompt.new.select "expiration:", {
"doesn't matter": false,
"burn after reading": "burn",
"keep forever": 0,
"5 minutes": 5,
"1 hour": 60,
"1 day": 1440,
"1 week": 10080,
"1 month": 40320,
"1 year": 483840,
}.map{ |name, value|
paster = paster.dup
paster.expire = value
size = paster.services.size
size.zero? ?
{name: "#{name}", value: paster, disabled: "(no pastebins)"} :
{name: "#{name} (#{size})", value: paster}
}, filter: true, cycle: true, per_page: 100
rescue TTY::Reader::InputInterrupt
abort ""
end
paster.paste
__END__
<select name="expire" id="expire" class="select" tabindex="7">
<option value="burn">Burn on reading</option>
<option value="5">5 Minutes</option>
<option value="60">1 Hour</option>
<option value="1440">1 Day</option>
<option value="10080">1 Week</option>
<option value="40320">1 Month</option>
<option value="483840">1 Year</option>
<option value="0" selected="selected">Keep Forever</option>
</select>
year maxsize raw syntax lineno expire expno burn unlisted private edit nojs api multiple auth openid delanon delfree delpub highlight
- + + + + + + + + + + + + + + + + + - +
sprunge.us 2008 10000000 1 1 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0
paste.the-compiler.org 2013 15000000 1 1 1 1 1 1 1 0 0 1 1 0 0 0 0 0 0 0
{"text":"text","html5":"html","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"lua","bash":"sh","erlang":"erlang","go":"golang","c":"c_cpp","cpp":"c_cpp","diff":"diff","latex":"latex","sql":"sql","xml":"xml","0":"text","abap":"abap","actionscript":"actionscript","actionscript3":"actionscript","ada":"ada","apache":"apache_conf","applescript":"applescript","asm":"assembly_x86","autohotkey":"autohotkey","closure":"closure","cobol":"cobol","coffeescript":"coffee","cpp-winapi":"c_cpp","c_loadrunner":"c_cpp","c_mac":"c_cpp","c_winapi":"c_cpp","csharp":"csharp","d":"d","dart":"dart","dot":"dot","eiffel":"eiffel","fortran":"fortran","groovy":"groovy","haskell":"haskell","haxe":"haxe","ini":"ini","io":"io","java":"java","java5":"java","make":"makefile","matlab":"matlab","mysql":"mysql","objc":"objectivec","ocaml":"ocaml","pascal":"pascal","perl":"perl","perl6":"perl","postgresql":"pgsql","powershell":"powershell","prolog":"prolog","properties":"properties","rails":"ruby","rust":"rust","scala":"scala","scheme":"scheme","smarty":"smarty","tcl":"tcl","vala":"vala","vb":"vbscript","verilog":"verilog","vhdl":"vhdl","yaml":"yaml"}