now.thirdparty.PyInquirer.prompts.editor module#

editor type question

exception now.thirdparty.PyInquirer.prompts.editor.EditorArgumentsError[source]#

Bases: Exception

class now.thirdparty.PyInquirer.prompts.editor.Editor(editor=None, env=None, require_save=True, extension='.txt')[source]#

Bases: object

now.thirdparty.PyInquirer.prompts.editor.edit(text=None, editor=None, env=None, require_save=True, extension='.txt', filename=None)[source]#

Edits the given text in the defined editor. If an editor is given (should be the full path to the executable but the regular operating system search path is used for finding the executable) it overrides the detected editor. Optionally, some environment variables can be used. If the editor is closed without changes, None is returned. In case a file is edited directly the return value is always None and require_save and extension are ignored.

If the editor cannot be opened a UsageError is raised.

Note for Windows: to simplify cross-platform usage, the newlines are automatically converted from POSIX to Windows and vice versa. As such, the message here will have \n as newline markers.

  • text – the text to edit.

  • editor – optionally the editor to use. Defaults to automatic detection.

  • env – environment variables to forward to the editor.

  • require_save – if this is true, then not saving in the editor will make the return value become None.

  • extension – the extension to tell the editor about. This defaults to .txt but changing this might change syntax highlighting.

  • filename – if provided it will edit this file instead of the provided text contents. It will not use a temporary file as an indirection in that case.

now.thirdparty.PyInquirer.prompts.editor.question(message, **kwargs)[source]#