Metadata-Version: 2.1
Name: editor
Version: 0.10.2
Summary: Open the default text editor
Home-page: https://github.com/rec/editor
Author: Tom Ritchford
Author-email: tom@swirly.com
License: MIT
Keywords: testing,modules
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Requires-Dist: xmod

🖋 editor - open a text editor, user edits, return results  🖋
------------------------------------------------------------------

``editor`` opens an editor onto an existing file, a new file, or a tempfile,
lets the user edit text, and returns the results.

EXAMPLE: using a temporary file

If no filename is provided, a temporary file gets edited, and its
contents returned.

.. code-block:: python

    import editor

    MESSAGE = 'Insert comments below this line

'
    comments = editor(MESSAGE)
    # Pops up the default editor with a tempfile, containing MESSAGE

EXAMPLE: Using a named file

If a filename is provided, then it gets edited!

.. code-block:: python

    import os

    FILE = 'file.txt'
    assert not os.path.exists(FILE)

    comments = editor(MESSAGE, filename=FILE)
    # Pops up an editor for new FILE containing MESSAGE, user edits

    assert os.path.exists(FILE)

    # You can edit an existing file too, and select your own editor.
    # By default, it uses the editor from the environment variable EDITOR

    comments2 = editor(filename=FILE, editor='emacs')

API
===

``editor.editor(initial_contents=None, filename=None, editor=None)``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(`editor.py, 53-87 <https://github.com/rec/editor/blob/master/editor.py#L53-L87>`_)

Open a text editor, user edits, return results

ARGUMENTS
  initial_contents
    If not None, this string is written to the file before the editor
    is opened.

  filename
    If not None, the name of the file to edit.  If None, a temporary file
    is used.

  editor
    The path to an editor to call.  If None, use editor.default_editor()

``editor.default_editor()``
~~~~~~~~~~~~~~~~~~~~~~~~~~~

(`editor.py, 89-97 <https://github.com/rec/editor/blob/master/editor.py#L89-L97>`_)

Return the default text editor.

This is the contents of the environment variable EDITOR, or  ``'vim'`` if
that variable is not set or is empty.

(automatically generated by `doks <https://github.com/rec/doks/>`_ on 2020-07-22T13:36:34.262844)


