Sha256: eb7276496b26659379cadfbb738b13099704df2c05d22b3690fcb6b2eb33c6bd
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
module Rea class Command # # Search publications on the online libraries # # SYNOPSIS # #{command_name} [options] ARG # # OPTIONS # #{summarized_options} # class Search < Quickl::Command(__FILE__, __LINE__) include Utils # Install options options do |opt| @provider = Rea::providers.first @mainarg = :title @query = {} Rea::providers.each do |p| opt.on("--#{p.shortcut}", "Search on #{p.url}"){ @provider = p } end opt.on("--title=[TITLE]", "Specify the publication title"){|title| if title @query[:title] = title else @mainarg = :title end } @keep = nil opt.on("--show=a,b,c", "Only show a, b, and c attributes", Array) do |list| @keep = list.map(&:to_sym) end end def run(*args) puts pretty(super, @keep) end # Run the command def execute(args) raise Quickl::Help if args.size > 1 @query[@mainarg] = args.first if args.size == 1 @provider.search(@query) end end # class Search end # class Command end # module Rea
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rea-0.0.1 | lib/rea/command/search.rb |