weggli icon indicating copy to clipboard operation
weggli copied to clipboard

Add a small repl

Open fabianfreyer opened this issue 4 years ago • 3 comments

Implement a small REPL shell using rustyline.

It parses all the sources into a tree once, displaying a status bar as it goes along: image

Then you can query from a REPL, and it's actually a bit more responsive. The repl does minimal checks like bracket matching: image

Questions:

  • What to do with regexps? These should be changable too.

fabianfreyer avatar Jan 28 '22 10:01 fabianfreyer

I'd be interested in whether there's a specific reason for the way the arguments are currently. bb3a3439ac7d4306c91ee55369ef20daf51286fc is a bit of a horrible cludge, and if there's a nicer way of doing this, I'd be really curious.

fabianfreyer avatar Jan 28 '22 10:01 fabianfreyer

Thanks for the PR. This looks pretty cool.

The current argument ordering is based on grep/ripgrep defaults. Originally weggli also supported an empty path argument to search the current directory but I already removed that feature. Still, I would like to avoid the breaking change in bb3a343.

Let me think about the best way to implement the argument parsing for a bit and I'll get back to you.

felixwilhelm avatar Jan 28 '22 13:01 felixwilhelm

Rebased this on the latest main. @felixwilhelm any thoughts on how we could work around the argument parsing issue?

fabianfreyer avatar Sep 24 '22 01:09 fabianfreyer