-
Notifications
You must be signed in to change notification settings - Fork 958
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
post edit should use local EDITOR not EDITOR on the server #5760
Comments
I do not intend to learn In case someone cares, here is my #!/bin/bash
set -Eeuxo pipefail
id="$(wp @stage post list --field="ID" --name="$1" --post_type=page)"
wp @stage post get "$id" --field="post_content" > /tmp/temp-page.html
codium --wait /tmp/temp-page.html
wp @stage post update "$id" --post_content="$(cat /tmp/temp-page.html)" |
It does use EDITOR when EDITOR is set in environment: And defaults to vi if it is not set. So something is causing EDITOR not to be set. I looked and the previous closed ticket said:
But that is technically a bit different than running a command remotely (via alias) which is described here. You could verify what wp-cli thinks the EDITOR value is on the remote server by running:
I suspect it would be empty. This is just a guess, but I know a default in lots of .bashrc files is to have something like this near the very top: # If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac Which causes it to exit if it isn't an interactive SSH login. So that might be preventing it from running if your |
@mrsdizzie Thanks, that is exactly it. Moved the export above that line and it works now. I do not get why a ssh session that may as well be interactive and it actually is in this cases opening an editor and w8ing for user input not counts as interactive. I still think the command should use the local editor. Also looking at the code is tries to launch notepad on windows. Notepad is a GUI app, does that even work? I never used windows server and I should not care at all but it seems to make no sense to me. I know there is x-forwarding, but windows does not use X server so that can't work. I also looked it up and there is a "Windows server core" that is actually headless so I am curious. // And it seems I am right https://superuser.com/questions/186857/how-do-i-edit-text-files-in-the-windows-command-prompt This suggests it should be |
By "local" editor, do you mean the editor that is defined on the machine from which you're connecting (as opposed to the machine into which you are connecting remotely)? That would be very unusual; off the top of my head I can't think of any *nix-flavored utility that works that way. For doing "local" edits, I think a better approach is to do a |
I moved this to the main repo because it's more of a framework issue. I agree that the developer experience of aliases and I'd be open to reviewing a more holistic proposal, if someone wants to do the research, get feedback from users, etc. |
Feature request
Turns out I was wrong about
vi
being hardcoded.I changed this to a feature request.
WP-CLI seems to have the wrong concept of "local" at least for installing plugins from zip file, it requires the file to be on the server that is the opposite of "local". The edit command never speaks of local anywhere I guess but I think its the same thing. WP-CLI should do things where you call it, locally, not on the server.
The text was updated successfully, but these errors were encountered: