editor


Nameeditor JSON
Version 1.6.6 PyPI version JSON
download
home_pagehttps://github.com/rec/editor
Summary🖋 Open the default text editor 🖋
upload_time2024-01-25 10:44:59
maintainer
docs_urlNone
authorTom Ritchford
requires_python>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            # 🖋 editor - Open a text editor 🖋

`editor` opens the default text editor or your favorite editor to edit an existing file,
a new file, or a tempfile, blocks while the user edits text, then returns the contents
of the file.

You can pass a parameter `editor=` to specify an editor or leave it empty, in which
case the editor is:

* The contents of the environment variable `VISUAL`, if it's set, otherwise:
* The the contents of the environment variable `EDITOR`, if it's set, otherwise:
* The string `'Notepad'`, if the code is running on Windows, otherwise:
* The string `'vim'`

### Example 1: Using a temporary file

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

    import editor

    comments = editor.editor(text='Comments here\n\n')
    # Pop up the default editor with a tempfile containing "Comments here",
    # then return the contents and delete the tempfile.

### Example 2: Using a named file

If a filename is provided, then that file gets edited.

    import os

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

    comments = editor.editor(text=MESSAGE, filename=FILE)
    # Pop up an editor for a new FILE containing MESSAGE, user edits
    # This file is saved when the user exits the editor.

    assert os.path.exists(FILE)

    # You can edit an existing file too, and select your own editor.
    comments2 = editor.editor(filename=FILE, editor='emacs -nw')

### [API Documentation](https://rec.github.io/editor#editor--api-documentation)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/rec/editor",
    "name": "editor",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Tom Ritchford",
    "author_email": "tom@swirly.com",
    "download_url": "https://files.pythonhosted.org/packages/2a/92/734a4ab345914259cb6146fd36512608ea42be16195375c379046f33283d/editor-1.6.6.tar.gz",
    "platform": null,
    "description": "# \ud83d\udd8b editor - Open a text editor \ud83d\udd8b\n\n`editor` opens the default text editor or your favorite editor to edit an existing file,\na new file, or a tempfile, blocks while the user edits text, then returns the contents\nof the file.\n\nYou can pass a parameter `editor=` to specify an editor or leave it empty, in which\ncase the editor is:\n\n* The contents of the environment variable `VISUAL`, if it's set, otherwise:\n* The the contents of the environment variable `EDITOR`, if it's set, otherwise:\n* The string `'Notepad'`, if the code is running on Windows, otherwise:\n* The string `'vim'`\n\n### Example 1: Using a temporary file\n\nIf no filename is provided, a temporary file gets edited, and its contents\nreturned.\n\n    import editor\n\n    comments = editor.editor(text='Comments here\\n\\n')\n    # Pop up the default editor with a tempfile containing \"Comments here\",\n    # then return the contents and delete the tempfile.\n\n### Example 2: Using a named file\n\nIf a filename is provided, then that file gets edited.\n\n    import os\n\n    FILE = 'file.txt'\n    assert not os.path.exists(FILE)\n\n    comments = editor.editor(text=MESSAGE, filename=FILE)\n    # Pop up an editor for a new FILE containing MESSAGE, user edits\n    # This file is saved when the user exits the editor.\n\n    assert os.path.exists(FILE)\n\n    # You can edit an existing file too, and select your own editor.\n    comments2 = editor.editor(filename=FILE, editor='emacs -nw')\n\n### [API Documentation](https://rec.github.io/editor#editor--api-documentation)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "\ud83d\udd8b Open the default text editor \ud83d\udd8b",
    "version": "1.6.6",
    "project_urls": {
        "Documentation": "https://rec.github.io/editor",
        "Homepage": "https://github.com/rec/editor",
        "Repository": "https://github.com/rec/editor"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1bc24bc8cd09b14e28ce3f406a8b05761bed0d785d1ca8c2a5c6684d884c66a2",
                "md5": "2d1d6902051b5c88172d059d1f974cb5",
                "sha256": "e818e6913f26c2a81eadef503a2741d7cca7f235d20e217274a009ecd5a74abf"
            },
            "downloads": -1,
            "filename": "editor-1.6.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2d1d6902051b5c88172d059d1f974cb5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4017,
            "upload_time": "2024-01-25T10:44:58",
            "upload_time_iso_8601": "2024-01-25T10:44:58.660328Z",
            "url": "https://files.pythonhosted.org/packages/1b/c2/4bc8cd09b14e28ce3f406a8b05761bed0d785d1ca8c2a5c6684d884c66a2/editor-1.6.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2a92734a4ab345914259cb6146fd36512608ea42be16195375c379046f33283d",
                "md5": "fec51cb0883f9ff5b8cc3771dbb57393",
                "sha256": "bb6989e872638cd119db9a4fce284cd8e13c553886a1c044c6b8d8a160c871f8"
            },
            "downloads": -1,
            "filename": "editor-1.6.6.tar.gz",
            "has_sig": false,
            "md5_digest": "fec51cb0883f9ff5b8cc3771dbb57393",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 3197,
            "upload_time": "2024-01-25T10:44:59",
            "upload_time_iso_8601": "2024-01-25T10:44:59.909860Z",
            "url": "https://files.pythonhosted.org/packages/2a/92/734a4ab345914259cb6146fd36512608ea42be16195375c379046f33283d/editor-1.6.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-25 10:44:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rec",
    "github_project": "editor",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "editor"
}
        
Elapsed time: 0.17229s