Sha256: 53d46b2599d3ddbc2b4c6201a3edfa9b7ccd2e39c725a0a8046090a9df5a7c57

Contents?: true

Size: 721 Bytes

Versions: 1

Compression:

Stored size: 721 Bytes

Contents

LuxCli.class_eval do
  desc :get, 'Get single page by path "lux get /login"'
  method_option :body,   desc: 'Show body',    type: :boolean, aliases: "-b", default: false
  method_option :info,   desc: 'Show info',    type: :boolean, aliases: "-i", default: false
  method_option :type,   desc: 'Request type', type: :boolean, aliases: "-i", default: false
  def get path
    require './config/app'

    Cli.die "Use\n -b to show body\n -i to show info" unless options[:body] || options[:info]

    data = Lux.app.new(path).render

    if options[:body]
      puts data[:body]
    elsif options[:info]
      data[:body] = 'BODY lenght: %s kB' % (data[:body].length.to_f/1024).round(1)
      ap data.to_h
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lux-fw-0.6.2 ./bin/cli/get.rb