class FallCli::Middleware::Browser

Check if the client has set-up configuration yet.

Constants

SPLASH

Public Instance Methods

call(env) click to toggle source
# File lib/fallcli/middleware/browser.rb, line 64
def call(env)
  config = env["config"]

  say SPLASH

  sleep(2)

  songs = env['dropbox-client'].ls

  browser = FallCli::BrowserHelper.new(songs)

  Dispel::Screen.open do |screen|
    screen.draw show_ui(browser)

    Dispel::Keyboard.output do |key|
      case key
      when :up then browser.position_up
      when :down then browser.position_down
      when "q" then break
      end
      screen.draw show_ui(browser)
    end
  end

  @app.call(env)
end
show_ui(filelist_obj) click to toggle source
# File lib/fallcli/middleware/browser.rb, line 9
def show_ui filelist_obj
  ["\n", filelist_obj.show_files, "\nCurrent position: #{filelist_obj.position + 1} "].join("\n")
end