Skip to content
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

Add a small repl #38

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add a small repl #38

wants to merge 3 commits into from

Conversation

fabianfreyer
Copy link
Contributor

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
Copy link
Contributor Author

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

@felixwilhelm
Copy link
Collaborator

felixwilhelm commented Jan 28, 2022

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.

While this does break existing workflows, there are two main arguments
for doing this:
1. it is a more a common workflow, that the path is kept constant while
   the query is iterated upon. Having the query as the last positional
   argument makes it easier to go up in history and edit the query.
2. it sets things up to for other interactive input methods for queries.
@fabianfreyer
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants