Skip to content

Instantly share code, notes, and snippets.

@ZacCranko
Last active August 9, 2016 23:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZacCranko/ac505c8db680ba97a9be to your computer and use it in GitHub Desktop.
Save ZacCranko/ac505c8db680ba97a9be to your computer and use it in GitHub Desktop.
Current juliarc.jl
push!(LOAD_PATH, pwd())
# Run _init.jl at runtime if it exists
if VERSION < v"0.4-"
if isinteractive() && isfile("_init.jl")
info("Found ", joinpath(pwd(),"_init.jl"))
include(joinpath(pwd(),"_init.jl"))
end
else
atreplinit() do repl
if isfile("_init.jl")
info("Found ", joinpath(pwd(),"_init.jl"))
include(joinpath(pwd(),"_init.jl"))
end
end
end
# Use macros since it's easier to type @function than function()
# Edit this file
macro juliarc()
edit("~/.juliarc.jl")
end
# Methods macro
macro methods(m)
@eval methods($m)
end
# Run _init.jl if it exists
macro init()
if isfile("_init.jl")
info("Found ", joinpath(pwd(),"_init.jl"))
include("_init.jl")
else
print("_init.jl not found in current directory: $(pwd()). Create one instead? (y/n) ")
rl = readline(STDIN)
if first(rl) == 'y'
edit("_init.jl")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment