#Is there a way to run a Command like ripgrep and take the results into the UI?

13 messages · Page 1 of 1 (latest)

ivory compass
#

Trying to add search to my app, and stumbled onto https://github.com/BurntSushi/ripgrep that works well on the shell, but wondering how best to run it from tauri, and take the output (attached screenshot) and display on the UI.

Tried using the Command API like

const cmd = new Command("query-search", [
      "-i",
      "/Users/folder",
    ]);

and tauri.conf looks like this

        "all": true,
        "scope": [
          {
            "name": "query-search",
            "cmd": "rg",
            "args": ["-i", { "validator": "\\S+" }]
          }
        ]
      },

But unsure how to get the results

GitHub

ripgrep recursively searches directories for a regex pattern while respecting your gitignore - GitHub - BurntSushi/ripgrep: ripgrep recursively searches directories for a regex pattern while respec...

ivory compass
#

Bumping up to see if there seems to be a way @prisma cloak @icy cove

prisma cloak
#

ripgrep is also avail as a library in case you know rust

#

otherwise your code looks good so far, only gotta add a stdout data listener as shown here https://tauri.app/v1/api/js/shell#command and the per line output it gives you should already be pretty workable looking at your screenshot

ivory compass
prisma cloak
#

it always was available but not sure if it was/is visible in the readme

ivory compass
#

So cargo install ripgrep
and then follow the same tauri.conf.json and add an stdout?

prisma cloak
#

for the command variant, that would be it, yes

#

or

#

if you want to ship it with your app and not just use on your own computer you'd look for a download on their github (or just copy it from ~/.cargo/bin) and use tauri's sidecar feature to bundle the ripgrep cli with your app

ivory compass
#

Nice! Will read up and report back! thanks a bunch