diff --git a/base/show.jl b/base/show.jl index 2a5123d99980c..39ea8daf3037e 100644 --- a/base/show.jl +++ b/base/show.jl @@ -1108,17 +1108,21 @@ function show_nd(io::IO, a::AbstractArray, limit, print_matrix, label_slices) cartesianmap(print_slice, tail) end -function whos(m::Module, pattern::Regex) +function whos(m::Module, pattern::Regex; filter=Module) + filtertypes = applicable(start, filter) ? + filter : + [filter] for v in sort(names(m)) s = string(v) - if isdefined(m,v) && ismatch(pattern, s) + if ( ! (typeof(eval(m,v)) in filtertypes) && + isdefined(m,v) && ismatch(pattern, s)) println(rpad(s, 30), summary(eval(m,v))) end end end -whos() = whos(r"") -whos(m::Module) = whos(m, r"") -whos(pat::Regex) = whos(current_module(), pat) +whos(;filter=Module) = whos(r""; filter=filter) +whos(m::Module; filter=Module) = whos(m, r""; filter=filter) +whos(pat::Regex; filter=Module) = whos(current_module(), pat; filter=filter) # global flag for limiting output # TODO: this should be replaced with a better mechanism. currently it is only diff --git a/doc/stdlib/base.rst b/doc/stdlib/base.rst index 2fb84e8db8cd8..3260c5101901e 100644 --- a/doc/stdlib/base.rst +++ b/doc/stdlib/base.rst @@ -36,10 +36,12 @@ Getting Around Determine whether Julia is running an interactive session. -.. function:: whos([Module,] [pattern::Regex]) +.. function:: whos([Module,] [pattern::Regex]; [filter=Module]) Print information about exported global variables in a module, optionally restricted - to those matching ``pattern``. + to those matching ``pattern``. The ``filter`` keyword is either a single type or + iterable object of types that will not be displayed. By default, only imported + submodules are filtered out. .. function:: edit(file::AbstractString, [line])