Sha256: f679879330ec2ebccc86cc1915e2824bba1b2f919c4f0002ab51cc9ba878fd6f
Contents?: true
Size: 788 Bytes
Versions: 1
Compression:
Stored size: 788 Bytes
Contents
require 'rbkb/cli' # urldec converts a url percent-encoded string back to its raw form. # Input can be supplied via stdin, a string argument, or a file (with -f). # (url percent-encoding is just fancy hex encoding) class Rbkb::Cli::Urldec < Rbkb::Cli::Executable def make_parser() super() add_std_file_opt(:indat) arg = @oparse arg.banner += " <data | blank for stdin>" arg.on("-p", "--[no-]plus", "Convert '+' to space (default: true)") do |p| @opts[:noplus] = (not p) end end def parse(*args) super(*args) parse_string_argument(:indat) parse_catchall() end def go(*args) super(*args) # Default to standard input @opts[:indat] ||= @stdin.read() @stdout << @opts[:indat].urldec(:noplus => @opts[:noplus]) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
emonti-rbkb-0.6.2 | lib/rbkb/cli/urldec.rb |