Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better $EDITOR handling #983

Open
aleeraser opened this issue Jan 9, 2025 · 1 comment
Open

Better $EDITOR handling #983

aleeraser opened this issue Jan 9, 2025 · 1 comment

Comments

@aleeraser
Copy link

The current EDITOR handling is a bit lacking.

editor = "/bin/nano"
# Use the user preferred editor if available
if "EDITOR" in os.environ:
editor = os.environ["EDITOR"]
elif os.path.isfile("/etc/alternatives/editor"):
editor = "/etc/alternatives/editor"

Improvements:

  • check that /bin/nano exists before trying to spawn a subprocess
    • or better, search for nano in PATH instead of using a hardcoded path
  • use a universally-included editor like vi as default
    • if the goal was to use a more beginner-friendly editor, then perhaps resort to vim only if nano is not available
  • suggest using sudo -E howdy [...] in the documentation, as otherwise the command would run in a non-interactive shell (i.e. without sourcing the initialization files), and no environment variable is carried over (including EDITOR) unless explicitly preserved
@aleeraser aleeraser changed the title Better EDITOR handling Better $EDITOR handling Jan 9, 2025
@boltgolt
Copy link
Owner

boltgolt commented Jan 9, 2025

Sounds good, please open a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants