Skip to content

RFC: new startup mode: load a file after loading ~/.juliarc #1364

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

Closed
wants to merge 1 commit into from
Closed
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
26 changes: 20 additions & 6 deletions base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ function process_options(args::Array{Any,1})
quiet = false
repl = true
startup = true
deferred = Any[]
if has(ENV, "JL_POST_BOOT")
eval(parse_input_line(ENV["JL_POST_BOOT"]))
end
Expand Down Expand Up @@ -170,6 +171,14 @@ function process_options(args::Array{Any,1})
# see repl-readline.c
elseif args[i] == "-f" || args[i] == "--no-startup"
startup = false
elseif args[i]=="-X"
# use next argument as a filename for deferred execution
repl = false
i+=1
push(deferred, args[i])
# remove already-processed arguments
ARGS = args[i+1:end]
break
elseif args[i][1]!='-'
# program
repl = false
Expand All @@ -182,7 +191,8 @@ function process_options(args::Array{Any,1})
end
i += 1
end
return (quiet,repl,startup)

return (quiet,repl,startup,deferred)
end

const _jl_roottask = current_task()
Expand Down Expand Up @@ -229,13 +239,13 @@ function _start()
abs_path("$JULIA_HOME/../lib/julia/ui"),
]

(quiet,repl,startup) = process_options(ARGS)
(quiet,repl,startup,deferred) = process_options(ARGS)

if repl
if startup
try include(strcat(ENV["HOME"],"/.juliarc.jl")) end
end
if startup
try include(strcat(ENV["HOME"],"/.juliarc.jl")) end
end

if repl
global _jl_have_color = begins_with(get(ENV,"TERM",""),"xterm") ||
success(`tput setaf 0`)
global _jl_is_interactive = true
Expand All @@ -244,6 +254,10 @@ function _start()
end
run_repl()
end

for fl in deferred
load(fl)
end
catch e
show(e)
println()
Expand Down