-
Notifications
You must be signed in to change notification settings - Fork 8
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
Allow limiting selection to only GUI/CLI options #10
Comments
My goal with this crate is to have behavior similar to Git, which also opens a terminal editor even from a GUI if that is what is set in your The easiest solution is the same as it is for Git: change your default editor to a GUI editor. Many Git tutorials have this as one of the first steps, but I agree that it would be better UX-wise not to have to do this. One workaround if you want this to Just Work for anyone using your GUI app is to set the // find the GUI editor of your choice
let gui_editor = "/usr/local/bin/my-editor";
std::env::set_var("EDITOR", gui_editor);
edit::edit("edit me"); // should open my-editor |
Is it expected for the crate to open the CLI editor in a new terminal window if invoked from a GUI editor? |
Instead of trying to provide a hardcoded blacklist why not provide the tools for the library consumer to do this themselves? Something like get_editors() that returns a list of all present editors the library tracks, and then an edit_with_editor() that accepts the names returned by get_editors? This would put the figuring out if it's gui or cli part on the crate consumer, but at least give them the tools to do it. It'd also be nice for GUI tools to be able to present a list of editors found and choose a default there, since I would rather not have EDITOR set to vscode, but there are things I would rather have open in vscode. |
I'm working on a GUI application, and was hoping to be able to use this crate to allow users to edit some files. However, it seems to be attempting to launch my CLI editor (nvim) despite being launched from a GUI, which unfortunately makes this crate unusable as it is now.
The text was updated successfully, but these errors were encountered: