-
Notifications
You must be signed in to change notification settings - Fork 178
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
no_ui
option that directly writes the first suggestion to a file
#276
base: master
Are you sure you want to change the base?
Conversation
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like if it cannot find a match, it should return nothing, not the search query?
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.
Yes, I somehow misunderstood what the original UI code was doing.
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of requiring --output_selection
, you could allow two options:
- With
--output_selection
, write to the--output_selection
selection 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should update all print!
to eprint(ln)!
before merging this.
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.
Agreed!
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
mcfly
start 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.