Sha256: 453124002c910efdb8330377944ff7480646146319e9c75266196a8c7d94bfc3

Contents?: true

Size: 822 Bytes

Versions: 2

Compression:

Stored size: 822 Bytes

Contents

module Wassup
  module Panes
    module Shortcut
      class Stories
        attr_accessor :query_pages

        def initialize(query: nil, query_pages: nil)
          @query_pages = query_pages
          @query_pages ||= { "": query } if query
        end

        def configure(pane)
          pane.content do |content|
            query_pages.each do |k,v|
              stories = Helpers::Shortcut.search_stories(query: v)
              stories.each do |story|
                display = Helpers::Shortcut::Formatter.story(story)
                content.add_row(display, story, page: k.to_s)
              end
            end
          end
          pane.selection('enter', 'Open in Shortcut') do |story|
            url = story['app_url']
            `open #{url}`
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wassup-0.4.1 lib/wassup/panes/shortcut.rb
wassup-0.4.0 lib/wassup/panes/shortcut.rb