no_ui option that directly writes the first suggestion to a file#276
no_ui option that directly writes the first suggestion to a file#276kmod-midori wants to merge 1 commit intocantino:masterfrom
no_ui option that directly writes the first suggestion to a file#276Conversation
|
Thanks @chengyuhui. Can you explain a bit more what you hope to use this for? |
|
I hope to have shell scripts call |
|
|
||
| let cmd = match matches.first() { | ||
| Some(cmd) => cmd.cmd.to_owned(), | ||
| None => settings.command.to_owned(), |
There was a problem hiding this comment.
It seems like if it cannot find a match, it should return nothing, not the search query?
There was a problem hiding this comment.
Yes, I somehow misunderstood what the original UI code was doing.
There was a problem hiding this comment.
This is still returning the search query, right?
| } | ||
|
|
||
| let out = format!("mode display\ncommandline {}\n", cmd_t); | ||
| if let Some(path) = &settings.output_selection { |
There was a problem hiding this comment.
Instead of requiring --output_selection, you could allow two options:
- With
--output_selection, write to the--output_selectionselection file as you're doing now. - Without output_selection, instead just print one or more matches to STDOUT for scripts to parse.
There was a problem hiding this comment.
It was originally written this way, however I found that we are happily print!-ing many messages to STDOUT, which (given the current output format) might mess up parsing for simple scripts.
There was a problem hiding this comment.
We should only be using print! to output when there's an error. Those should probably be converted to use STDERR.
There was a problem hiding this comment.
We should update all print! to eprint(ln)! before merging this.
|
Could do the proposal in #307, if it allowed a |
|
Is it suitable for use when it is called on every key entered into the terminal? If it is, and it does not show the UI, then it should work well. |
|
Are you still working on this? |
|
just a bump that there is definitely interest in this no-ui direct suggestion capability. |
This should make #85 eaiser to do, since we do not need to deal with the UI popping up. Bypassing the UI should also make
mcflystart a little faster.I was originally wanting to add support for
-inoutput_selection, but since we are doingprint!everywhere, this will not be effective as standard output may contain all kinds of messages.