2 releases
Uses old Rust 2015
0.1.1 | Apr 14, 2018 |
---|---|
0.1.0 | Apr 14, 2018 |
#139 in #text-editors
7KB
52 lines
Plume is a library which can be used in command-line tools to let users write text in their favourite editor.
Think about how Git spawns your ${EDITOR} to let you write a commit message.
Usage
extern crate plume;
use plume::get_text;
let text = get_text()?;
The above will:
-
find the text editor to use
- if the
${EDITOR}
environment variable is set, then its value is used; - otherwise, Plume will search for known text editors like
nano
orvim
;
- if the
-
launch that text editor and capture the text entered by the user;
-
return that text.
License
Plume is offered under the terms of the GNU Lesser General Public License, either version 3 or any later version.
lib.rs
:
Plume enables your command-line tools to ask users to write text in their favourite editor.
This works similarly to how Git spawns your ${EDITOR}
to let you write a
commit message.
Plume will first check the ${EDITOR}
environment variable. If it is set,
then the value is used as the text editor.
If ${EDITOR}
is not set, then Plume will search for a well-known text
editor. If it finds one installed, then it will use it.
Plume then spawns the text editor, letting the user type their text. When they save and close the editor, Plume will retrieve the entered text and return it.
Currently, the list of well-known text editors are, in this order:
/usr/bin/nano
/usr/bin/vim
/usr/bin/vi
This should work on most UNIX-like operating systems.
Dependencies
~1.7–10MB
~113K SLoC