{%
    local fru_prop_names = {
        {key = 'ChassisType',         value = ' Chassis Type          : '},
        {key = 'ChassisPartNumber',   value = ' Chassis Part Number   : '},
        {key = 'ChassisSerialNumber', value = ' Chassis Serial Number : '},
        {key = 'ChassisCustomInfo',   value = ' Chassis Extend label  : '},
        {key = 'MfgDate',             value = ' Board Mfg. Date       : '},
        {key = 'BoardManufacturer',   value = ' Board Manufacturer    : '},
        {key = 'BoardProductName',    value = ' Board Product Name    : '},
        {key = 'BoardSerialNumber',   value = ' Board Serial Number   : '},
        {key = 'BoardPartNumber',     value = ' Board Part Number     : '},
        {key = 'BoardFRUFileID',      value = ' Board FRU File ID     : '},
        {key = 'BoardCustomInfo',     value = ' Extend label          : '},
        {key = 'ManufacturerName',    value = ' Product Manufacturer  : '},
        {key = 'ProductName',         value = ' Product Name          : '},
        {key = 'ProductPartNumber',   value = ' Product Part Number   : '},
        {key = 'ProductVersion',      value = ' Product Version       : '},
        {key = 'ProductSerialNumber', value = ' Product Serial Number : '},
        {key = 'AssetTag',            value = ' Product Asset Tag     : '},
        {key = 'ProductFRUFileID',    value = ' Product FRU File ID   : '},
        {key = 'ProductCustomInfo',   value = ' Product Extend label  : '}
    }
    -- 按照分隔符;返回字符数组
    local function ExtendlabelSplit(input)
        local start_pos = 1
        local delim = ';'
        local res = {}
        while true do
            local find_l, find_r = string.find(input, delim, start_pos, true)
            if not find_l then
                break
            end
            table.insert(res, string.sub(input, start_pos, find_l - 1))
            start_pos = find_r + 1
        end
        table.insert(res, string.sub(input, start_pos))
        return res
    end

    local function ReplaceRules(str)
        -- 转义字符只支持换行和回车
        str = string.gsub(str, '\\', '\\\\')
        str = string.gsub(str, '\n', '\\n')
        str = string.gsub(str, '\r', '\\r')
        return str
    end

    local function PrintData(data, hosts)
        local print_str = string.format('FRU Device Description : Builtin FRU Device (FRUID %s, %s', data.FruId, data.FruName)
        if hosts and hosts[tostring(data.FruId)] then
            local system_id = tonumber(SystemId, 10)
            if system_id ~= 255 and system_id ~= hosts[tostring(data.FruId)]then
                return
            end
            print_str = print_str .. ', System' .. hosts[tostring(data.FruId)]
        end

        echo(print_str .. ')\n')
        for _, prop in pairs(fru_prop_names) do
            if string.len(data[prop.key]) ~= 0 then
                -- 以下三种需要按照;分隔换行打印
                if prop.key ~= 'ChassisCustomInfo' and prop.key ~= 'BoardCustomInfo' and prop.key ~= 'ProductCustomInfo' then
                    echo(ReplaceRules(prop.value .. data[prop.key]) .. '\n')
                else
                    local LabelArr = ExtendlabelSplit(data[prop.key])
                    echo(ReplaceRules(prop.value .. LabelArr[1]) .. '\n')
                    for i = 2, #LabelArr do
                        echo('                         ' .. ReplaceRules(LabelArr[i]) .. '\n')
                    end
                end
            end
        end
        echo('\n')
    end

    -- 含有-t参数
    if Target == true then
        for _, FruItem in pairs(GetFruList) do
            if FruItem.FruId == 0 then
                PrintData(FruItem)
            end
        end
    else -- 不含-t参数
        local fru_hosts = GetFruHost
        table.sort(GetFruList, function(a, b)
            local host_id_a = fru_hosts[tostring(a.FruId)] or 0
            local host_id_b = fru_hosts[tostring(b.FruId)] or 0
            if host_id_a == host_id_b then
                return a.FruId < b.FruId
            else
                return host_id_a < host_id_b
            end
        end)
        for _, FruItem in pairs(GetFruList) do
            PrintData(FruItem, fru_hosts)
        end
    end
    -- 清除末尾的换行符
    echo('\b')
%}
