Sha256: 3294ec9d41864577d2884fdcf166ce1fa3b77b757ddf285b77ff87070b4c87ba

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

#!/usr/bin/env ruby

require 'pickpocket'

require 'thor'

class PickpocketCLI < Thor
  package_name 'Pickpocket'

  desc 'oauth', '1st authorization step: ask Pocket to allow Pickpocket app'
  def oauth
    oauth = Pickpocket::Authentication::Oauth.new
    oauth.request_authorization
  end

  desc 'authorize', '2nd authorization step: allow Pickpocket read/write access to your library'
  def authorize
    oauth = Pickpocket::Authentication::Oauth.new
    oauth.authorize
  end

  desc 'pick', 'Picks a random article from your library (marking it as read)'
  method_option :quantity, aliases: '-q', banner: '1', desc: 'Quantity of articles to open', type: :numeric, default: 1
  def pick
    quantity = options[:quantity].to_i

    library = Pickpocket::Articles::Library.new
    library.pick(quantity)
  end

  desc 'renew', 'Syncs your local library with your Pocket. It will delete read articles and download new articles from your library'
  def renew
    library = Pickpocket::Articles::Library.new
    library.renew
    library.stats
  end

  desc 'stats', 'Show the number of read/unread articles you have on your local library'
  def stats
    library = Pickpocket::Articles::Library.new
    library.stats
  end
end

PickpocketCLI.start(ARGV)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pick-pocket-0.2.3 bin/pickpocket
pick-pocket-0.2.2 bin/pickpocket