simeji/jid

Don't exit on Enter

lodenrogue opened this issue ยท 9 comments

Can we change the way the program exits when you hit the 'Enter' button? Maybe make the default exit ctrl-C?

Pressing 'Enter' should select the given auto-complete suggestion.

@lodenrogue Sorry, I can't imagine your situation. Please explain me that detail?
ex. json, query, your os, etc..

In the demo example

  • .users[1] *Tab* - shows you the result
  • .users[1] *Enter* - exits the program

Its confusing when Enter causes a program to terminate.

What ashishg-qburst said

What do you think Enter should do when there are no suggestions being chosen?

Even doing nothing would be preferable to exiting the program. Enter is too common of a "accept my input" command and I already exited jid three times accidentally this way :)

Is anyone working on this? I can help to do this.

I love jiq. But *ENTER* is my enemy :-(

I often accidentally hit enter (or more often paste something in that has a trailing "enter") and

*BAM*

the thing I almost had working is gone. Sometimes I know enough to recreate it in seconds, other times it was really complex, and I have to start over.

I'd suggest, jid should use q to quit.
Enter is used to select an element from the tab completion list, if there is more than one element. If there is none or one, Enter currently quits. User's are very likely to fall into this trap, as jid is meant to explore the json structure. thus we cannot expect that the user predicts the structure correctly.

When jid quits, it prints the selected value to the console. I'd also suggest to print a trailing newline. Currently the selected value just squeezes in before the prompt, and users may miss the fact, that it is actually there.

Wow I just realized I opened this in 2016. That's over 5 years ago. Any progress on this?