-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Support Editor env with options in config edit #7391
Conversation
Generally Eidtor env is a single string referring to a program but nothing prevents user from attaching options within it. To fully conform to the convention `pip config edit` should split the env first.
Could you provide reference whether this is the right thing to do? I briefly searched, but all references I found to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a reasonable approach that addresses the point raised by @uranusjr:
def get_editor_cmd():
editor = os.environ["EDITOR"]
result = shutil.which(editor)
if result:
return [result]
if os.path.exists(editor):
return [editor]
return shlex.split(editor)
Then if we want to deprecate non-shell-syntax in the future we could warn if os.path.exists(editor) and ([editor] != shlex.split(editor))
.
We would also need tests for this.
(discussion on whether to do this is on #7392).
Thanks for experimenting with this @chrahunt! So, we should do this. I think we should pass |
Be careful to test I'm not saying don't use Actually, there may be other issues too - has anyone considered how switching to |
This would be backwards-incompatible and may be less obvious for users who just want to set their editor path directly. I updated my previous comment with an example implementation in case that makes it clearer how much code we're talking about.
I don't think using |
@chrahunt’s suggestion looks good to me, except |
It has been some time without movement on this, so I will close it. I've left a comment on #7392 with details for anyone that wants to pick this back up. |
Generally the
EDITOR
env is a single string referring to a program butnothing prevents user from attaching options within it. To fully conform
to the convention
pip config edit
should split the env first.Fixes #7392.