unison/docs/commandline-editor-dev.md
2019-03-04 13:59:23 -05:00

1.0 KiB

The Unison CLI code is made up of a few components:

CommandLine.Main sets up threads to watch the filesystem and parse stdin to produce Editor.Events and Editor.Inputs respectively.

Editor.Input parsers are defined in InputPattern.hs and InputPatterns.hs.

Action.loop receives Editor.Events and Editor.Inputs and executes Editor.Commands. This loop can't use IO or access the Codebase.

Editor.Commands are defined in Editor.hs and interpreted by Editor.commandLine. Editor.commandLine does use IO and access the Codebase.`

One of the Editor.Commands that can be executed is Notify, which presents an Editor.Output to the user. Our presentation implementation is in OutputMessages.notifyUser.

CLI is in charge of remembering what branch the user is working on. It currently keeps an in-memory copy of the Branch, but I'm not sure that buys us anything besides headache, given that every operation needs to hit the disk anyway. I guess it could be used to detect an external change.