File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ ` python-editor ` is a library that provides the ` editor ` module for programmatically
2
+ interfacing with your system's $EDITOR.
3
+
4
+ Examples
5
+ --------
6
+
7
+ ```
8
+ import editor
9
+ commit_msg = editor.edit(contents="# Enter commit message here")
10
+ ```
11
+ Opens an editor, prefilled with the contents, "# Enter commit messdage here".
12
+ When the editor is closed, returns the contents in variable ` commit_msg ` .
13
+
14
+
15
+ ```
16
+ import editor
17
+ editor.edit(file="README.txt")
18
+ ```
19
+ Opens README.txt in an editor. Changes are saved in place.
20
+
21
+
22
+ How it Works
23
+ ------------
24
+ ` editor ` first looks for the ${EDITOR} environment variable. If set, it uses
25
+ the value as-is, without fallbacks.
26
+
27
+ If no $EDITOR is set, editor will search through a list of known editors, and
28
+ use the first one that exists on the system.
29
+
30
+ For example, on Linux, ` editor ` will look for the following editors in order:
31
+
32
+ * vim
33
+ * emacs
34
+ * nano
35
+
36
+ When calling the ` edit() ` function, ` editor ` will open the editor in a subprocess,
37
+ inheriting the parent process's stdin, stdout
You can’t perform that action at this time.
0 commit comments