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

Proposal: Make the find built-in more versatile #164

Open
canadaduane opened this issue Jan 20, 2023 · 1 comment · May be fixed by #172
Open

Proposal: Make the find built-in more versatile #164

canadaduane opened this issue Jan 20, 2023 · 1 comment · May be fixed by #172

Comments

@canadaduane
Copy link
Contributor

canadaduane commented Jan 20, 2023

I recently modified the find plugin to add the --full-path arg to the underlying fdfind CLI.

In doing so, it seemed to me there were really a lot of options that could be quite reasonable for fdfind, notably the --glob parameter, which makes the launcher's find command behave more like a command-line pattern match (as opposed to the regex style pattern match that is currently the default).

My first impulse was to make the find command take a config.ron that allows to choose glob vs regex. However, I realized the entire find plugin is a great example of a potentially reusable pattern--

  1. Given a CLI command that lists results as output (e.g. fdfind)
  2. and a set of arguments to pass in as defaults (e.g. --full-path, --regex, --glob, etc.)
  3. pass the search-term as last argument to the CLI tool
  4. display each line from STDOUT as a corresponding result in the launcher
  5. pass the result to a command to run when executed

To my surprise, this pattern is actually already built for URLs--it's the web plugin! We just need something that behaves this way for CLI tools.

Would it make sense to either

  • (a) modify the find plugin to be more versatile so that it has a config.ron similar to the web plugin, but to use CLI commands instead of xdg-open, or
  • (b) create an entirely new plugin that does the same?

I'm kind of thinking (a) makes more sense since if I build this, then the current find command would become simply a setting to add to the config.ron of this modified plugin (i.e. the modified plugin would functionally be a superset of the find plugin).

Any thoughts or guidance before I dig in?

@mmstick
Copy link
Member

mmstick commented Jan 21, 2023

I'm open to the idea. I've had on my backlog of ideas to integrate Rhai into the launcher so that plugins can be written as Rhai scripts internally executed by the launcher.

@canadaduane canadaduane linked a pull request Feb 18, 2023 that will close this 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 a pull request may close this issue.

2 participants