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

allow access to help mode at REPL #49

Open
bjarthur opened this issue Oct 12, 2021 · 3 comments
Open

allow access to help mode at REPL #49

bjarthur opened this issue Oct 12, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@bjarthur
Copy link

would be convenient if docstrings could be accessed in the usual way with ? at the infiltrator prompt. not sure how hard this would be to implement though.

@pfitzseb
Copy link
Member

This is gonna be slightly annoying to implement. In the meantime I'd recommend @doc:

julia> foo(x) = @infiltrate
foo (generic function with 1 method)

julia> foo(3)
Infiltrating foo(x::Int64) at REPL[2]:1:

infil> @doc sin
  sin(x)

  Compute sine of x, where x is in radians.

  sin(A::AbstractMatrix)

  Compute the matrix sine of a square matrix A.

  If A is symmetric or Hermitian, its eigendecomposition (eigen) is used to compute the sine. Otherwise, the sine is
  determined by calling exp.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> sin(fill(1.0, (2,2)))
  2×2 Matrix{Float64}:
   0.454649  0.454649
   0.454649  0.454649

@pfitzseb pfitzseb added the enhancement New feature or request label Oct 12, 2021
@bjarthur
Copy link
Author

hah! nice. that suffices. i did not know about @doc. maybe document in the REPL help? it is not mentioned there:

infil> ?
  Code entered is evaluated in the current functions module. Note that you cannot change local
  variables, but can assign to globals in a permanent store module.

  The following commands are special cased:
    - `?`: Print this help text.
    - `@trace`: Print the current stack trace.
    - `@locals`: Print local variables.
    - `@exfiltrate`: Save all local variables into the store.
    - `@toggle`: Toggle infiltrating at this `@infiltrate` spot (clear all with `Infiltrator.clear_disabled!()`).
    - `@continue`: Continue to the next infiltration point or exit (shortcut: Ctrl-D).
    - `@exit`: Stop infiltrating for the remainder of this session and exit (on Julia versions prior to
      1.5 this needs to be manually cleared with `Infiltrator.end_session!()`).

@pfitzseb
Copy link
Member

pfitzseb commented Oct 12, 2021

That's because it's not specific to Infiltrator at all (the same works in the normal REPL). But yes, adding a note can't hurt: bc6fbcf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants