Sha256: bbf30ceb313e8e9abcda6300e6c98846fbb2af51d6bdd9554f8db067186ff439

Contents?: true

Size: 764 Bytes

Versions: 1

Compression:

Stored size: 764 Bytes

Contents

module Alf
  module Shell
    class Metadata < Shell::Command(__FILE__, __LINE__)

      options do |opt|

        opt.on_tail('-h', "--help", "Show help") do
          show_help("alf-metadata")
        end

      end

      def run(argv, requester)
        # set requester and parse options
        @requester = requester
        argv = parse_options(argv, :split)

        operand = compile(argv)
        keys    = operand.keys.to_a.map{|k| k.to_a }
        heading = Relation(operand.heading.to_hash.each_pair.map{|k,v|
          {attribute: k, type: v.to_s}
        })
        puts Relation({heading: heading, keys: keys})
      end

      def compile(argv)
        operand(argv.shift)
      end

    end # class Metadata
  end # module Shell
end # module Alf

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alf-shell-0.15.0 lib/alf/shell/command/metadata.rb