hazwaz.mixins module¶
-
class
hazwaz.mixins.ExternalEditorMixin[source]¶ Bases:
objectAdd facilities to open a file in an external editor to a Command.
-
edit_file_in_external_editor(filepath: str) → bool[source]¶ Open filepath in an external editor and wait for it to be closed.
Return whether opening the file was succesful. This tries to cycle through all editors listed in self.editors.
-
editors= [('vim', '$EDITOR (set to {editor})'), ('sensible-editor', 'sensible-editor'), ('vi', 'vi')]¶ A list of editors to try.
Defaults to the value of
$EDITOR, followed bysensible-editor, followed byvias a last resort.Each editor should be a tuple
(<executable>, <name>), where<name>is printed in case of errors.To write unittests that use this mixin, you can override this attribute with
[("true"), ("true")].
-