External Editor API#

The reusable terminal editor is provided by the separate edital package. Import its APIs directly from edital. Confease supplies validation and persistence; see Configuration Model for that integration.

Explicit external launcher#

This reference is generated from Confease’s source docstrings with Sphinx autodoc.

class confease.TextEditor(editor=None)#

Small blocking text-editor launcher.

TextEditor resolves an explicit editor command, EDITOR/VISUAL, or a small list of common terminal and visual editors. Known visual editors receive a wait flag when needed so callers can safely read the file after the process exits.

Parameters:

editor (str | None)

property editor#

Return the configured editor command, or None for auto-detection.

open(path)#

Open the configured editor for an existing or new file path.

Parameters:

path (str | Path) – File path to open.

Return type:

str

Notes

The launcher does not create or open the file itself. A missing file is created only if the editor saves it.

Return type:

str

Returns:

The expanded file path as a string after the editor exits.

Raises:
  • ValueError – If path is None.

  • Exception – If the editor cannot be launched or exits unsuccessfully.

Parameters:

path (str | Path)

read()#

Open a temporary file and return its contents after editing.

Returns:

The text written by the editor.

Raises:

Exception – If the editor cannot be launched or exits unsuccessfully.