2 releases

0.1.1 Apr 14, 2018
0.1.0 Apr 14, 2018

#6 in Text editors

Download history 6/week @ 2018-07-04 2/week @ 2018-07-11 6/week @ 2018-07-18 3/week @ 2018-07-25 8/week @ 2018-08-01 13/week @ 2018-08-08 16/week @ 2018-08-15 2/week @ 2018-08-22 3/week @ 2018-09-05 1/week @ 2018-09-12 1/week @ 2018-09-19 2/week @ 2018-09-26

19 downloads per month

LGPL-3.0+

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:

  1. 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 or vim;
  2. launch that text editor and capture the text entered by the user;

  3. 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

~1MB
~11K SLoC