Skip to content

Commit

Permalink
🚮 Added Dump
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp committed Sep 27, 2020
1 parent b3ca9f8 commit a9df6cc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PlutoUI"
uuid = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
authors = ["Fons van der Plas <[email protected]>"]
version = "0.6.4"
version = "0.6.5"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
17 changes: 16 additions & 1 deletion src/Terminal.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export with_terminal
export with_terminal, Dump

import Suppressor: @color_output, @capture_out, @capture_err
import Logging: ConsoleLogger, with_logger
Expand Down Expand Up @@ -41,6 +41,8 @@ end
```julia
with_terminal(dump, [1,2,[3,4]])
```
See also [PlutoUI.Dump](@ref).
"""
function with_terminal(f::Function, args...; kwargs...)
Expand All @@ -62,4 +64,17 @@ function with_terminal(f::Function, args...; kwargs...)
$(isempty(spam_err) ? "" : "<pre class='err'>" * htmlesc(spam_err) * "</pre>")
</div>
""")
end

"""
Dump(x; maxdepth=8)
Show every part of the representation of a value. The depth of the output is truncated at maxdepth.
This is a variant of [`Base.dump`](@ref) that returns the representation directly, instead of printing it to stdout.
"""
function Dump(x; maxdepth=8)
sprint() do io
dump(io, x; maxdepth=maxdepth)
end |> Text
end

2 comments on commit a9df6cc

@fonsp
Copy link
Member Author

@fonsp fonsp commented on a9df6cc Sep 27, 2020

Choose a reason for hiding this comment

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

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/22040

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.5 -m "<description of version>" a9df6ccb275f8cb9594110b6d5a0ee7173e356d8
git push origin v0.6.5

Please sign in to comment.