Pre-release
This release is a pre-release and may not be stable for production use.
get-unicode-multiline-input-with-editor
Opens $EDITOR to get multi-line input as a list of Unicode strings, just like what git commit does.
- Determines
$EDITOReither manually or via the Git-flavored heuristics inget-unicode-arguments-to-launch-editor - Supports optional initial content and comment lines
- Opens a temporary file in the editor to get multi-line input
- Ignores comment lines and blank lines in the result
- Works with Python 2+
Installation
pip install get-unicode-multiline-input-with-editor
Usage
# coding=utf-8
from __future__ import print_function
from get_unicode_multiline_input_with_editor import get_unicode_multiline_input_with_editor
result = get_unicode_multiline_input_with_editor(
unicode_initial_input_lines=[
u'Write something here...',
u'# Enter your text above.',
u'# Lines starting with # will be ignored.'
],
unicode_line_comments_start_with=u'#', # specify `None` to not skip over any line
editor=None # or specify e.g. 'vim'
)
print(result)
Assuming nano is the default editor, the user will see something like this:
GNU nano 7.2 /tmp/tmp9khfi5es.txt
Write something here...
# Enter your text above.
# Lines starting with # will be ignored.
^G Help ^O Write Out ^W Where Is ^K Cut ^T Execute ^C Location M-U Undo M-A Set Mark
^X Exit ^R Read File ^\ Replace ^U Paste ^J Justify ^_ Go To Line M-E Redo M-6 Copy
Afterward, if the user enters some text, print(result) basically prints whatever the user entered, minus the comments.
Contributing
Contributions welcome! Please open issues or pull requests on GitHub.
License
This project is licensed under the MIT License.
Release files for get-unicode-multiline-input-with-editor 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| get_unicode_multiline_input_with_editor-0.1.0a1.tar.gz | 3.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| get_unicode_multiline_input_with_editor-0.1.0a1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 7.8 kB
Release files / get_unicode_multiline_input_with_editor-0.1.0a1.tar.gz
| Download URL | get_unicode_multiline_input_with_editor-0.1.0a1.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
03dafda3e865b23d877410529e6441a6880c760d1aa5cde0d5b00cfbf639d7e8
|
|
BLAKE2b-256 checksum How to use checksums |
2e3681a9b80901f9fc5489f212ad4b7252abe135c3fa7e32528622b39cdc7c1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Release files / get_unicode_multiline_input_with_editor-0.1.0a1-py2.py3-none-any.whl
| Download URL | get_unicode_multiline_input_with_editor-0.1.0a1-py2.py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c0c0abf65823665f975a7fa7db63675d5726c14afd39d0aaddef9e60d4ee77f8
|
|
BLAKE2b-256 checksum How to use checksums |
cfd7d7557d7694aa7edf7dd8fbe45eb84efbbd8f0eaf4d915bc2d6a8648314c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|