Acorn.jl/src/Acorn.jl

62 lines
1.1 KiB
Julia
Raw Normal View History

module Acorn
2017-08-03 22:41:59 +02:00
include("terminal.jl")
# Configuration submodule
include("EditorConfig.jl")
using .EditorConfig
include("row.jl")
include("cmds/Command.jl")
include("editor.jl")
# Load commands
include("cmds/open.jl")
include("cmds/save.jl")
include("cmds/quit.jl")
include("cmds/find.jl")
include("cmds/help.jl")
include("cmds/bind.jl")
include("cmds/set.jl")
include("cmds/echo.jl")
2017-08-03 23:21:01 +02:00
function acorn(filename::String; rel::Bool=true)
2017-08-03 22:41:59 +02:00
ed = Editor()
2017-08-04 14:39:12 +02:00
#rel && (filename = abspath(filename))
2017-08-03 22:41:59 +02:00
editorOpen(ed, filename)
2017-08-08 20:52:40 +02:00
setStatusMessage(ed, "HELP: ctrl-p: command mode | ctrl-q: quit | ctrl-s: save")
2017-08-03 22:41:59 +02:00
Base.Terminals.raw!(ed.term, true)
try
while !ed.quit
refreshScreen(ed)
processKeypress(ed)
end
catch ex
editorQuit(ed, force=true)
throw(ex)
end
Base.Terminals.raw!(ed.term, false)
return nothing
end
function acorn()
# If a file is given, open it
if length(ARGS) > 0
filename = ARGS[1]
acorn(filename, rel=false)
end
end
export
acorn
end # module