Skip to content

Commit

Permalink
Update README and rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Maarrk committed Jul 29, 2024
1 parent 5ded548 commit 7ba572a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 38 deletions.
44 changes: 7 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,20 @@
# SilverBullet Grep Plug

`silverbullet-grep` is a [Plug](https://silverbullet.md/Plugs) for [SilverBullet](https://silverbullet.md/) to search notes in your space using [ripgrep](https://github.com/BurntSushi/ripgrep).
`silverbullet-grep` is a [Plug](https://silverbullet.md/Plugs) for [SilverBullet](https://silverbullet.md/) to search notes in your space using `git grep` command.

## Installation

**Install ripgrep for your system**, following [ripgrep documentation](https://github.com/BurntSushi/ripgrep?tab=readme-ov-file#installation)
If you run SilverBullet [using Docker](https://silverbullet.md/Install/Docker), Git is already included.
Otherwise install Git from your system's package manager, or following [Git documentation](https://git-scm.com/).

Open your `PLUGS` note in SilverBullet and add this plug to the list:

```yaml
- https://github.com/Maarrk/silverbullet-grep/releases/latest/download/silverbullet-grep.plug.js
- https://github.com/Maarrk/silverbullet-grep/releases/latest/download/grep.plug.js
```
Then run the {[Plugs: Update]} command and off you go!
### How do I install ripgrep in the `zefhemel/silverbullet` Docker image?

The package `ripgrep` wasn't found by `apt` and there's no `curl` or `wget`.
This is how I did it, still thinking of a nicer way

```bash
docker ps
docker exec -it <container-id> /bin/bash
deno
```

Then ran the following script:

```js
const res = await fetch("https://github.com/BurntSushi/ripgrep/releases/download/14.1.0/ripgrep_14.1.0-1_amd64.deb");
const file = await Deno.open("./ripgrep.deb", { create: true, write: true });
await res.body.pipeTo(file.writable);
file.close();
```

I got an error on `file.close()` but it still worked for me.
Then with the file finally in the container, I ran:

```bash
dpkg -i ./ripgrep.deb
```

## Usage
The plug provides the following commands:
Expand Down Expand Up @@ -69,17 +43,13 @@ grep:
Yes.
## Why ripgrep?
## Roadmap
- Handles UTF-8
- Gives the same output on all platforms
- Better defaults (recursive search, parses `.gitignore`, multithreaded)
- Flags that made it easy to create this output
- Should be available on the same platforms as SilverBullet, since it's written in Rust like [Deno](https://deno.com)
- Exclude files matching the `spaceIgnore` setting

## Contributing

If you manage to find bugs, report them on the [issue tracker on GitHub](https://github.com/Maarrk/silverbullet-grep/issues).
If you find bugs, report them on the [issue tracker on GitHub](https://github.com/Maarrk/silverbullet-grep/issues).
I doubt I will implement more features, Pull Requests are preferred.

### Building from source
Expand Down
2 changes: 1 addition & 1 deletion grep.plug.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: silverbullet-grep
name: grep
requiredPermissions:
- shell
functions:
Expand Down

0 comments on commit 7ba572a

Please sign in to comment.