Hello all! I am having some trouble with ReplMaker.jl, and getting this error in return:
LoadError: UndefVarError: active_repl not defined
I wrote a little module I was intending to put " using UnixRepl" into my startup.jl file. Here is the code for my entire module so far:
using ReplMaker
Base.atreplinit() do repl
repl.interface = REPL.setup_interface(repl)
repl.interface.modes[1].prompt =
Pkg.REPLMode.promptf()[1:end-6] * " julia> "
end
function parse_command(s)
dims = split(s, " ")
command = dims[1]
if length(dims) != 1
param = dims[2]
end
if command == "cd"
cd(param)
elseif command == "ls"
readdir()
elseif command == "pwd"
pwd()
else
try
run(Cmd(s))
catch
println("Could not determine command")
end
end
end
initrepl(parse_command,
prompt_text="bash> ",
prompt_color = :yellow,
start_key='[',
mode_name="bash")
This is what I get when I include it from the original project files after activating with Pkg:
julia> emmett@y700:~/dev$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.6.0 (2021-03-24)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
(@v1.6) pkg> activate UnixRepl
Activating environment at `~/dev/UnixRepl/Project.toml`
(UnixRepl) pkg> status
Project UnixRepl v0.1.0
Status `~/dev/UnixRepl/Project.toml`
[b873ce64] ReplMaker v0.2.5
julia> include("UnixRepl/src/UnixRepl.jl")
REPL mode bash initialized. Press [ to enter and backspace to exit.
Main.UnixRepl
bash> cd ..
bash> ls
42-element Vector{String}:
".android"
".atom"
".bash_history"
".bash_logout"
".bashrc"
".cache"
".config"
".expo"
".gnome"
".gnupg"
⋮
"Fonts"
"Music"
"Pictures"
"Public"
"Templates"
"Videos"
"dev"
"node_modules"
"package-lock.json"
bash> cd Videos
bash> ls
String[]
bash> pwd
"/home/emmett/Videos"
However, anytime it is either
A. loaded into startup.jl
B. ran in startup.jl
C. imported simply using using
I get that same return, here is a stacktrace:
emmett@y700:~/dev$ julia
Activating new environment at `~/dev/UnixRepl.jl/Project.toml`
ERROR: LoadError: LoadError: UndefVarError: active_repl not defined
Stacktrace:
[1] include(fname::String)
@ Base.MainInclude ./client.jl:444
[2] top-level scope
@ ~/.julia/config/startup.jl:2
in expression starting at /home/emmett/.julia/config/UnixRepl.jl/src/UnixRepl.jl:1
in expression starting at /home/emmett/.julia/config/startup.jl:2
And that is with this startup.jl file:
using Pkg; Pkg.activate("UnixRepl.jl")
include("UnixRepl.jl/src/UnixRepl.jl")
I am uncertain, what is this issue? Thank you for the help.