local orgfilter = nyagos.filter
nyagos.filter = function(cmdline)
    if orgfilter then
        cmdline = orgfilter(cmdline)
    end
    local last
    repeat
        last = true
        cmdline = cmdline:gsub("(%S*)(%b{})(%S*)", function(left,mid,right)
            last = false
            local contents = string.sub(mid,2,-2)
            local result
            local is_replace = false
            for s in string.gmatch(contents,"[^,]+") do
                local value=left .. s .. right
                if result then
                    result = result .. " " .. value
                    is_replace = true
                else
                    result = value
                end
            end
            if is_replace then
                return result
            else
                return left .. "%u+007B%" .. contents .. "%u+007D%" ..right
            end
        end)
    until last
    return cmdline:gsub("%%u%+007B%%","{"):gsub("%%u%+007D%%","}")
end

local orgfilter = nyagos.filter
nyagos.filter = function(cmdline)
    if orgfilter then
        cmdline = orgfilter(cmdline)
    end
    repeat
        local last = true
        cmdline = cmdline:gsub("(%S*)(%b{})(%S*)", function(left,mid,right)
            local contents = string.sub(mid,2,-2)
            local result
            local init = 1
            while true do
                local comma=string.find(contents,",",init,true)
                local value=left .. string.sub(contents,init,(comma or 0)-1) .. right
                if result then
                    result = result .. " " .. value
                else
                    result = value
                end
                if not comma then
                    break
                end
                init = comma + 1
            end
            if init > 1 then
                last = false
                return result
            else
                return nil
            end
        end)
    until last
    return cmdline
end

Support empty fragmenets like a{,b}c
Support empty fragmenets like a{,b}c
