function my_varinfo(m::Module=Main, pattern::Regex=r""; all::Bool = false, imported::Bool = false, sortby::Symbol = :name, recursive::Bool = false) @assert sortby in [:name, :size, :summary] "Unrecognized `sortby` value `:$sortby`. Possible options are `:name`, `:size`, and `:summary`" function _populate_rows(m2::Module, allrows, include_self::Bool) newrows = Any[ let value = getfield(m2, v) ssize_str, ssize = if value===Base || value===Main || value===Core ("", typemax(Int)) else ss = Base.summarysize(value) (Base.format_bytes(ss), ss) end Any[string(v), ssize_str, Base.summary(value), ssize] end for v in names(m2; all, imported) if (string(v) != split(string(m2), ".")[end] || include_self) && isdefined(m2, v) && occursin(pattern, string(v)) ] if recursive for row in newrows if row[3] == "Module" && !in(split(row[1], ".")[end], ["Base", "Main", "Core"]) && !in(string(getfield(m2, Symbol(split(row[1], ".")[end]))),first.(allrows)) row[1] = string(getfield(m2, Symbol(split(row[1], ".")[end]))); push!(allrows,row); _populate_rows(getfield(m2, Symbol(split(row[1], ".")[end])), allrows, false) else row[1] = "$(m2).$(row[1])" push!(allrows,row) end end end return allrows end rows = _populate_rows(m, Vector{Any}[], true) if sortby == :name col, reverse = 1, false elseif sortby == :size col, reverse = 4, true elseif sortby == :summary col, reverse = 3, false end rows = sort!(rows, by=r->r[col], rev=reverse) pushfirst!(rows, Any["name", "size", "summary"]) return Markdown.MD(Any[Markdown.Table(map(r->r[1:3], rows), Symbol[:l, :r, :l])]) end