Skip to content

LilithHafner/BasicAutoloads.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BasicAutoloads

Build Status Coverage PkgEval Aqua

BasicAutoloads lets you say "whenever I type this in the REPL, run that for me". It's great for automatically loading interactive tools.

For example, put this in your startup.jl

if isinteractive()
    import BasicAutoloads
    BasicAutoloads.register_autoloads([
        ["@b", "@be"]            => :(using Chairmarks),
        ["@benchmark"]           => :(using BenchmarkTools),
        ["@test", "@testset", "@test_broken", "@test_deprecated", "@test_logs",
        "@test_nowarn", "@test_skip", "@test_throws", "@test_warn", "@inferred"] =>
                                    :(using Test),
        ["about, @about"]        => :(using About; macro about(x) Expr(:call, About.about, x) end),
        ["pager"]                => :(using TerminalPager),
    ])
end

Add BasicAutoloads and any packages you want to automatically load to your default environment, and then enjoy the benefits at the REPL:

julia> Test
ERROR: UndefVarError: `Test` not defined in `Main`
Suggestion: check for spelling errors or missing imports.

julia> @test 1+1 == 2 # Test is automatically loaded here
Test Passed

julia> Test
Test

Scripts and such will still need to explicitly load their deps.

For more details, see the docstring of register_autoloads