Skip to content

Commit

Permalink
Abbreviate varinfo signature and re-order for consistency
Browse files Browse the repository at this point in the history
The signature line is very long, so I dropped the ::Bool annotations which imo don't add value. I also switched from mixed `m=Main` and `imported = false` style to consistent `m=Main` and `imported=false`. Consistent within a single line is  better than inconsistent, and I chose more concise because we're well over the line limit.

Also reorder the function arguments to match the docstring. NFC, but might avoid some confusion for IDEs that show the actual signature.

cc @udohjeremiah
  • Loading branch information
LilithHafner committed Mar 2, 2023
1 parent dbcac43 commit c95fce8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stdlib/InteractiveUtils/src/InteractiveUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ include("macros.jl")
include("clipboard.jl")

"""
varinfo(m::Module=Main, pattern::Regex=r""; all::Bool = false, imported::Bool = false, recursive::Bool = false, sortby::Symbol = :name, minsize::Int = 0)
varinfo(m::Module=Main, pattern::Regex=r""; all=false, imported=false, recursive=false, sortby::Symbol=:name, minsize::Int=0)
Return a markdown table giving information about exported global variables in a module, optionally restricted
to those matching `pattern`.
Expand All @@ -34,7 +34,7 @@ The memory consumption estimate is an approximate lower bound on the size of the
- `sortby` : the column to sort results by. Options are `:name` (default), `:size`, and `:summary`.
- `minsize` : only includes objects with size at least `minsize` bytes. Defaults to `0`.
"""
function varinfo(m::Module=Base.active_module(), pattern::Regex=r""; all::Bool = false, imported::Bool = false, sortby::Symbol = :name, recursive::Bool = false, minsize::Int=0)
function varinfo(m::Module=Base.active_module(), pattern::Regex=r""; all::Bool = false, imported::Bool = false, recursive::Bool = false, sortby::Symbol = :name, minsize::Int=0)
sortby in (:name, :size, :summary) || throw(ArgumentError("Unrecognized `sortby` value `:$sortby`. Possible options are `:name`, `:size`, and `:summary`"))
rows = Vector{Any}[]
workqueue = [(m, ""),]
Expand Down

1 comment on commit c95fce8

@udohjeremiah
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one

Please sign in to comment.