Sha256: a4487b6b518a85a664cca720f0bb613eff1dc71f92dd522a95c1fae0fb41cd3c

Contents?: true

Size: 686 Bytes

Versions: 2

Compression:

Stored size: 686 Bytes

Contents

# -*- coding: utf-8 -*-

require 'pit'
require 'pinboard'
require 'colored'

module Pbl
  class CLI
    def initialize
      config = Pit.get(:pinboard,
        require: {
          username: "your_account_in_pinboard",
          password: "your_password_in_pinboard"
        }
      )

      @pinboard = Pinboard::Client.new(
        username: config[:username],
        password: config[:password]
      )

      @argv = ARGV || []
    end

    def self.run
      self.new.run
    end

    def run
      abort "Usage: pbl TAG" if @argv.empty?
      @pinboard.posts(:tag => @argv.join(',')).each do |post|
        puts "%s || %s" % [post[1], post[0].green]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pbl-0.0.3 lib/pbl/cli.rb
pbl-0.0.2 lib/pbl/cli.rb