| Server IP : 142.11.234.102 / Your IP : 216.73.217.78 Web Server : Apache System : Linux dal-shared-66.hostwindsdns.com 4.18.0-513.24.1.lve.1.el8.x86_64 #1 SMP Thu May 9 15:10:09 UTC 2024 x86_64 User : krnuyqrm ( 1183) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/self/root/opt/alt/python37/share/doc/alt-python37-editor/ |
Upload File : |
`python-editor` is a library that provides the `editor` module for programmatically
interfacing with your system's $EDITOR.
Examples
--------
```python
import editor
commit_msg = editor.edit(contents="# Enter commit message here")
```
Opens an editor, prefilled with the contents, `# Enter commit message here`.
When the editor is closed, returns the contents in variable `commit_msg`.
```python
import editor
editor.edit(file="README.txt")
```
Opens README.txt in an editor. Changes are saved in place.
How it Works
------------
`editor` first looks for the ${EDITOR} environment variable. If set, it uses
the value as-is, without fallbacks.
If no $EDITOR is set, editor will search through a list of known editors, and
use the first one that exists on the system.
For example, on Linux, `editor` will look for the following editors in order:
* vim
* emacs
* nano
When calling the `edit()` function, `editor` will open the editor in a subprocess,
inheriting the parent process's stdin, stdout