Programmatically open an editor, capture the result.
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python-editor-0.5.tar.gz.
File metadata
- Download URL: python-editor-0.5.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f65c033ede0758663b9ff6a29d702f0b09198ad7c4ef96c9d37ccdfbf7bbf6fa
|
|
| MD5 |
ece4f1848d93286d58df88e3fcb37704
|
|
| BLAKE2b-256 |
70f461ed2565eeb4fa2aa0bd0bd70ae5883edda9f2a1d94e6702be24c6710b7b
|
File details
Details for the file python_editor-0.5-py2.7.egg.
File metadata
- Download URL: python_editor-0.5-py2.7.egg
- Upload date:
- Size: 4.0 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1184f947a0f5cfa0f9528766280ac90e8a07cbf43bedda17a4672e22cf91794e
|
|
| MD5 |
28ffc2a828e7eb4aca093341c4dc2a90
|
|
| BLAKE2b-256 |
a5254e98c11b2ae30de87089975e79fa49df05ee2b5851cfc062fcfaba4da187
|