altsem / gitu

A TUI Git client inspired by Magit
MIT License
1.74k stars 89 forks source link

Requirement to set EDITOR should be documented, causes panic if not set. #35

Closed daveman1010221 closed 6 months ago

daveman1010221 commented 6 months ago

Title says it all. Program should probably exit gracefully if it can't find EDITOR, at minimum. It could also look at a few other ENV vars before giving up, such as: VISUAL: This variable serves a similar purpose to EDITOR. It's typically used by programs that require a text editor to launch in a graphical environment. If both EDITOR and VISUAL are set, programs often prioritize VISUAL.

GIT_EDITOR: Git, a widely used version control system, allows users to specify a separate editor specifically for Git operations using the GIT_EDITOR variable. If set, Git uses this editor instead of the default editor specified by EDITOR or VISUAL.

SUDO_EDITOR: When users execute commands with elevated privileges using sudo, the SUDO_EDITOR variable specifies the editor to use for editing files. It overrides both EDITOR and VISUAL for sudo commands.

altsem commented 6 months ago

I couldn't quite find a reference on how a cli would read SUDO_EDITOR in contrast to GIT_EDITOR. Would it take precedence?

Left it for now, but should be easy to add. Better error handling and reading of the other env vars should be handled in the newly released version!.