]> git.ipfire.org Git - thirdparty/git.git/blob - editor.h
documentation: fix choice of article
[thirdparty/git.git] / editor.h
1 #ifndef EDITOR_H
2 #define EDITOR_H
3
4 struct strbuf;
5
6 const char *git_editor(void);
7 const char *git_sequence_editor(void);
8 int is_terminal_dumb(void);
9
10 /**
11 * Launch the user preferred editor to edit a file and fill the buffer
12 * with the file's contents upon the user completing their editing. The
13 * third argument can be used to set the environment which the editor is
14 * run in. If the buffer is NULL the editor is launched as usual but the
15 * file's contents are not read into the buffer upon completion.
16 */
17 int launch_editor(const char *path, struct strbuf *buffer,
18 const char *const *env);
19
20 int launch_sequence_editor(const char *path, struct strbuf *buffer,
21 const char *const *env);
22
23 /*
24 * In contrast to `launch_editor()`, this function writes out the contents
25 * of the specified file first, then clears the `buffer`, then launches
26 * the editor and reads back in the file contents into the `buffer`.
27 * Finally, it deletes the temporary file.
28 *
29 * If `path` is relative, it refers to a file in the `.git` directory.
30 */
31 int strbuf_edit_interactively(struct strbuf *buffer, const char *path,
32 const char *const *env);
33
34 #endif