Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: print help command's last line #110

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
- '1.7'
- '1.8'
- '1.9'
- '1.10'
os:
- ubuntu-latest
arch:
Expand Down
4 changes: 4 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Infiltrator = "5903a43b-9cc3-4c30-8d17-598619ec4e9b"

[compat]
Documenter = "1"
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cp(joinpath(@__DIR__, "..", "README.md"), joinpath(@__DIR__, "src", "index.md");

makedocs(;
modules=[Infiltrator],
warnonly = [:missing_docs, :linkcheck],
format=Documenter.HTML(
prettyurls = get(ENV, "CI", nothing) == "true",
assets = ["assets/favicon.ico"],
Expand Down
10 changes: 10 additions & 0 deletions src/Infiltrator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ The following commands are special cased:

function show_help(io)
show(io, MIME("text/plain"), HELP_TEXT)
println(io, '\n')
end

function strlimit(str, limit = 30)
Expand All @@ -359,6 +360,10 @@ function strlimit(str, limit = 30)
end

function show_locals(io, locals, selected::AbstractSet = Set())
if isempty(locals)
println(io, "No local variables in this scope.\n")
return
end
for (var, val) in locals
if isempty(selected) || var in selected
one_line_show(io, var, val)
Expand Down Expand Up @@ -616,6 +621,11 @@ function get_module_names(m::Module, get_names = all_names)
end

function print_verbose_stacktrace(io, st, limit = 100)
if isempty(st)
println(io, "Toplevel scope\n")
return
end

len = length(st)
for (i, sf) in enumerate(st)
if i > limit
Expand Down
42 changes: 42 additions & 0 deletions test/outputs/Julia_anon_1.10.multiout
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
++++++++++++++++++++++++++++++++++++++++++++++++++
|Infiltrating <unknown>
|
|infil>
--------------------------------------------------
|AAAAAAAAAAAAAAAAAAAAAA
|
|BBBBBBB
++++++++++++++++++++++++++++++++++++++++++++++++++
|Infiltrating <unknown>
|
|infil> aasdf
|3
|
|infil>
--------------------------------------------------
|AAAAAAAAAAAAAAAAAAAAAA
|
|BBBBBBBCCCCC
|C
|
|BBBBBBB
++++++++++++++++++++++++++++++++++++++++++++++++++
|Infiltrating <unknown>
|
|infil> aasdf
|3
|
|infil> @exfiltrate aasdf
|Exfiltrating 1 local variable into the safehouse.
|
|infil>
--------------------------------------------------
|AAAAAAAAAAAAAAAAAAAAAA
|
|BBBBBBBCCCCC
|C
|
|BBBBBBBCCCCCCCCCCCCCCCCC
|CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
|
|BBBBBBB
42 changes: 42 additions & 0 deletions test/outputs/Julia_compiler_1.10.multiout
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
++++++++++++++++++++++++++++++++++++++++++++++++++
|Infiltrating <unknown>
|
|infil>
--------------------------------------------------
|AAAAAAAAAAAAAAAAAAAAAA
|
|BBBBBBB
++++++++++++++++++++++++++++++++++++++++++++++++++
|Infiltrating <unknown>
|
|infil> x
|:(%3)
|
|infil>
--------------------------------------------------
|AAAAAAAAAAAAAAAAAAAAAA
|
|BBBBBBBC
|CCCCC
|
|BBBBBBB
++++++++++++++++++++++++++++++++++++++++++++++++++
|Infiltrating <unknown>
|
|infil> x
|:(%3)
|
|infil> @exfiltrate
|Exfiltrating 1 local variable into the safehouse.
|
|infil>
--------------------------------------------------
|AAAAAAAAAAAAAAAAAAAAAA
|
|BBBBBBBC
|CCCCC
|
|BBBBBBBCCCCCCCCCCC
|CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
|
|BBBBBBB
Loading
Loading