weggli-rs / weggli

weggli is a fast and robust semantic search tool for C and C++ codebases. It is designed to help security researchers identify interesting functionality in large codebases.
Apache License 2.0
2.34k stars 130 forks source link

Add a small repl #38

Open fabianfreyer opened 2 years ago

fabianfreyer commented 2 years ago

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:

fabianfreyer commented 2 years ago

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.

felixwilhelm commented 2 years ago

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.

fabianfreyer commented 2 years ago

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