Sha256: db97bb0817506c0e32ee532e8460096cc7a21d32ad7b2fb4cd6a575aec577c4f
Contents?: true
Size: 1021 Bytes
Versions: 18
Compression:
Stored size: 1021 Bytes
Contents
#coding=utf-8 require "aio/core" class Aio::Module::Cmd::Cisco::ShowInv < Aio::Module::Cmd::Cisco include Aio::Module def initialize super({ :cmd_full => "show inventory", :cmd_short => "sh inv", :author => "Elin", :description => "This is Cisco Command# show inventory", :platform => "all", }) end def parse context = self.context.dup inv_info = {} useful[:inventory] = inv_info context.readline_range_loop(/NAME:/, reg_blank) do |cont| slot_info = {} name = "" description = "" cont.readline_match_block(/NAME: "(?<name>.*)", DESCR: "(?<description>.*)"/) do |block| name = block[:name] description = block[:description] end cont.readline_match_block(/PID: (?<pid>[^\s]+).*SN: (?<sn>[^\s]+)/) do |block| sn = block[:sn] inv_info[sn.to_sym] = slot_info block.update(slot_info, :name, name) block.update(slot_info, :description, description) block.update(slot_info, :pid) block.update(slot_info, :sn) end end end end
Version data entries
18 entries across 18 versions & 1 rubygems