[PATCH] Implement a simple read-eval-print loop.
servilio at gmail.com
Sat Nov 20 15:38:21 PST 2010
On 20 November 2010 16:15, Michal Sojka <sojkam1 at fel.cvut.cz> wrote:
> On Sat, 20 Nov 2010, servilio wrote:
>> This implementation uses GNU readline for the prompt and command
>> history, with the default file completion enabled. GLib is used to
>> split the read line into an arguments list.
> I haven't tested it yet, but it seems to be exactly the piece of code I
> wanted to have to speed up notmuch-hello when notmuch is used remotely
> over ssh. Spawning new ssh for every saved search to get the count of
> matched messages has a way too big overhead. Is this the use case you
> had in mind when implementing this?
Great to see that you find it useful. Yes, the remote usage was in my
mind, but it should enhance the local usage as well. We could also
create a quicker test run using the shell.
The disadvantage of using an interactive shell is that you can have
only one operation running in the UI, and I see no way of
interrumpting an operation unless you kill the process, but as
starting a new shell shouldn't be a biggie, this might not be as
limiting as might seem.
The ideal would be for libnotmuch to be able to connect to a
xapian-tcpsrv, but haven't had time to look at than, and an
interactive shell seemed to be less time demanding to implement (and
had the subjective promise of providing a lot of fun).
> Currently, I have only one comment to the patch. For me, "repl" is a bit
> unintuitive. I was thinking about "shell" as the name of subcommand for
I agree, maybe "shell" or "interactive" would be more intuitive, but
when I started "repl" was the only one I could think of.
More information about the notmuch