{"id":13587032,"url":"https://github.com/aslpavel/sweep-rs","last_synced_at":"2026-01-03T15:16:09.532Z","repository":{"id":41120341,"uuid":"300681539","full_name":"aslpavel/sweep-rs","owner":"aslpavel","description":"Sweep is a tool for interactive search through a list of entries. It is inspired by fzf.","archived":false,"fork":false,"pushed_at":"2024-04-21T17:45:16.000Z","size":2601,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-04-21T23:21:55.683Z","etag":null,"topics":["fzf","terminal"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aslpavel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-02T16:57:57.000Z","updated_at":"2024-08-01T16:33:01.496Z","dependencies_parsed_at":"2023-12-06T20:30:59.164Z","dependency_job_id":"531d0471-51d1-47f7-bd7b-ce93974a01d7","html_url":"https://github.com/aslpavel/sweep-rs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aslpavel%2Fsweep-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aslpavel%2Fsweep-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aslpavel%2Fsweep-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aslpavel%2Fsweep-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aslpavel","download_url":"https://codeload.github.com/aslpavel/sweep-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247716045,"owners_count":20984160,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fzf","terminal"],"created_at":"2024-08-01T15:05:58.680Z","updated_at":"2026-01-03T15:16:09.479Z","avatar_url":"https://github.com/aslpavel.png","language":"Rust","funding_links":[],"categories":["Rust","Search"],"sub_categories":[],"readme":"# Sweep\n\nSweep is a tool used to interactively search through a list of entries. It is inspired by [fzf](https://github.com/junegunn/fzf).\n![screenshot](resources/sweep.png)\n\n## Features\n\n- Fast\n- Beautiful\n- Easily customizable color palette by specifying only three main colors from which all other colors are derived.\n- JSON-RPC protocol can be used to communicate with sweep process.\n- Includes asyncio [python binding](sweep-py/sweep/sweep.py)\n- Configurable key bindings\n- Support for rendering custom icons/glyphs from SVG path (requires kitty-image or sixel protocol support)\n\n## Usage\n\n### Basic usage\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003e$ sweep --help\u003c/code\u003e\u003c/summary\u003e\n\n```\nUsage: sweep [-p \u003cprompt\u003e] [--prompt-icon \u003cprompt-icon\u003e] [--query \u003cquery\u003e] [--theme \u003ctheme\u003e] [--nth \u003cnth\u003e] [-d \u003cdelimiter\u003e] [--keep-order] [--scorer \u003cscorer\u003e] [--rpc] [--tty \u003ctty\u003e] [--no-match \u003cno-match\u003e] [--title \u003ctitle\u003e] [--json] [--io-socket \u003cio-socket\u003e] [--input \u003cinput\u003e] [--log \u003clog\u003e] [--preview \u003cpreview\u003e] [--layout \u003clayout\u003e] [--version]\n\nSweep is a command line fuzzy finder\n\nOptions:\n  -p, --prompt      prompt string\n  --prompt-icon     prompt icon\n  --query           initial query string\n  --theme           theme `(light|dark),accent=\u003ccolor\u003e,fg=\u003ccolor\u003e,bg=\u003ccolor\u003e`\n  --nth             filed selectors (i.e `1,3..-1`)\n  -d, --delimiter   filed delimiter character\n  --keep-order      do not reorder candidates\n  --scorer          default scorer to rank items\n  --rpc             switch to remote-procedure-call mode\n  --tty             path to the TTY (default: /dev/tty)\n  --no-match        action when there is no match and enter is pressed\n  --title           set terminal title\n  --json            candidates in JSON pre line format (same encoding as RPC)\n  --io-socket       use unix socket (path or descriptor) instead of stdin/stdout\n  --input           read input from the file (ignored if --io-socket)\n  --log             log file (configure via RUST_LOG environment variable)\n  --preview         create preview subprocess, requires full layout\n  --layout          layout mode specified as `name(,attr=value)*`\n  --version         show sweep version and quit\n  --help            display usage information\n```\n\n\u003c/details\u003e\n\n### Key bindings\n\nCurrent key bindings can be viewed by pressing `ctrl+h`.\n\n\u003cdetails\u003e\n  \u003csummary\u003eDefault key bindings\u003c/summary\u003e\n\n| Name                  | Key Bindings              | Description                                     |\n| --------------------- | ------------------------- | ----------------------------------------------- |\n| sweep.scorer.next     | `ctrl+s`                  | Switch to next available scorer                 |\n| sweep.select          | `ctrl+j` `ctrl+m` `enter` | Return item pointed by cursor                   |\n| sweep.quit            | `ctrl+c` `esc`            | Close sweep                                     |\n| sweep.help            | `ctrl+h`                  | Show help                                       |\n| sweep.preview.toggle  | `alt+p`                   | Toggle preview of an item                       |\n| input.move.forward    | `right`                   | Move cursor forward in the input field          |\n| input.move.backward   | `left`                    | Move cursor backward in the input field         |\n| input.move.end        | `ctrl+e`                  | Move cursor to the end of the input field       |\n| input.move.start      | `ctrl+a`                  | Move cursor to the beginning of the input field |\n| input.move.next_word  | `alt+f`                   | Move cursor to the end of the current word      |\n| input.move.prev_word  | `alt+b`                   | Move cursor to the start of the current word    |\n| input.delete.backward | `backspace`               | Delete character to the left                    |\n| input.delete.forward  | `delete`                  | Delete character to the right                   |\n| input.delete.end      | `ctrl+k`                  | Delete everything to the right                  |\n| list.item.next        | `ctrl+n` `down`           | Move to the next item in the list               |\n| list.item.prev        | `ctrl+p` `up`             | Move to the previous item in the list           |\n| list.page.next        | `pagedown`                | Move one page up                                |\n| list.page.prev        | `pageup`                  | Move one page down                              |\n| list.home             | `home`                    | Move to the beginning of the list               |\n| list.end              | `end`                     | Move to the end of the list                     |\n\n\u003c/details\u003e\n\n## Installation\n\n- Clone this repository\n- Install rust toolchain either with the package manager of your choice or with [rustup](https://rustup.rs/)\n- Build and install it with cargo (default installation path is $HOME/.cargo/bin/sweep make sure it is in your $PATH)\n\n  ```\n  $ cargo install --path sweep\n  ```\n\n- Or build it and copy the binary\n\n  ```\n  $ cargo build --release --bin=sweep\n  $ cp target/release/sweep ~/.bin\n  ```\n\n- Test it\n\n  ```\n  $ printf \"one\\ntwo\\nthree\" | sweep\n  ```\n\n- Enjoy\n\n## Demo\n\n![demo](resources/demo.gif)\n\nYou can also run [`python -msweep demo`](sweep/sweep/apps/demo.py) to see different formatting and icon usage. Note that to render icons terminal needs to support support kitty-image or sixel.\n![demo icons](resources/demo.png)\n\n## JSON-RPC\n\nSweep support [JSON-RPC](https://www.jsonrpc.org/specification) communication protocol for easy integration python and other languages. It is enabled by `--rpc` flag, by default standard input and output is used for communication but if `--io-socket` is passed it can be either file descriptor or path to a socket on the filesystem.\n\n### Wire protocol\n\nMessage is encoded as JSON per line\n\n### Methods and Types\n\n#### Types\n\n##### Item\n\n```\nItem = String\n| {\n    target: [Field],\n    right?: [Field],\n    right_offset?: int = 0,\n    right_face?: Face,\n    preview?: [Field],\n    preview_flex?: float = 0.0\n    ...\n}\n```\n\n`Item` is a searchable item, it can either be a string or a dictionary, if it is a string then it is equivalent to `{\"target\": string }`. This format of item is also used when `--json` flag is passed to sweep even without `--rpc`.\n\n- `target` - Is a list of fields that is searchable shown on the left side\n- `right` - Is a list of fields that is show on the right side\n- `right_offset` - Is a number of columns that will be allocated for the right field. If it is not specified right field will take as much space as needed.\n- `right_face` - Face used to fill right view\n- `preview` - Additional information that will be shown when item is selected\n- `preview_flex` - Determines how much space is allocated for preview, if it equal to 1.0 then it will take half of the available space. If i t is 0.0, then it will take as much space as needed.\n- `...` - any additional fields are not parsed but are returned as a part of the result\n\n##### Field\n\n```\nField = String\n| [String, bool]\n| {\n    text: String,\n    active?: bool = True,\n    glyph?: Icon,\n    face?: Face,\n    ref?: int\n}\n```\n\n`Field` is used to construct `Item`, it can either be a string, list or a dictionary. String is equivalent to having just `text` field in the dictionary. List is equivalent to having `text` and `active` field in the dictionary.\n\n- `text` - String content of the field\n- `active` - Whether string is searchable or not\n- `glyph` - Icon will be rendered in place of this field\n- `face` - Face used to render this field\n- `ref` - Reference to a field registered with `field_register`. If specified this field will inherit unspecified keys from registered field. It is useful when you want to avoid sending something like `Icon` multiple times.\n\n##### Face\n\n```\nFace = \"fg=#rrggbbaa,bg=#rrggbbaa,bold,italic,underline,blink,reverse,strike\"\n```\n\n`Face` is text and glyph styling options, it is a comma separated string of text attributes.\n\n- `fg` - foreground color (text color)\n- `bg` - background color\n- `bold` - bold text\n- `italic` - italic text\n- `underline` - show underline below text\n- `blink` - blink text\n- `reverse` - swap foreground and background\n\n##### Icon\n\n```\nIcon = {\n    path?: String,\n    view_box?: [float; 4],\n    fill_rule?: \"nonzero\" | \"evenodd\",\n    size?: [int; 2],\n}\n```\n\n`Icon` is an SVG path rendered as an icon, it is a dictionary with following attributes:\n\n- `path` - Path specified in the same format as `d` attribute of [SVG `path`](https://www.w3.org/TR/SVG11/paths.html).\n- `view_box` - [`minx`, `miny`, `width`, `height`] of the view port. If not specified bounding box with some padding is used.\n- `fill_rule` - same as SVG fill-rule. \"nonzero\" is a default.\n- `size` - [`rows`, `columns` ] how much space will be allocated for the icon.\n\n#### Methods\n\n| Method                                    | Description                                                                                                                                                                            |\n| ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `field_register(field: Field) -\u003e int`     | Register field that can be used as the base for the other field                                                                                                                        |\n| `items_extend(items: [Item])`             | Extend list of searchable items                                                                                                                                                        |\n| `items_clear()`                           | Clear list of searchable items                                                                                                                                                         |\n| `items_current() -\u003e Item?`                | Get currently selected item if any                                                                                                                                                     |\n| `query_set(query: String)`                | Set query string                                                                                                                                                                       |\n| `query_get() -\u003e String`                   | Get query string                                                                                                                                                                       |\n| `terminate()`                             | Gracefully terminate sweep process                                                                                                                                                     |\n| `prompt_set(prompt: String, icon?: Icon)` | Set prompt string (label string before search input)                                                                                                                                   |\n| `bind(key: String, tag: String)`          | Assign new key binding. `key` is a space separated list of chords, `tag` can either be sweep a action, a user action (bind notification is send) or empty string which means to unbind |\n| `preview_set(value?: bool)`               | Whether to show preview associated with the current item                                                                                                                               |\n\n#### Events\n\nEvents are encoded as method calls coming from the sweep process without id\n| Event | Description |\n| - | -- |\n| `select(item: Item)` | Entry was selected by pressing `Enter` (\"sweep.select\" action) |\n| `bind(tag: String)` | Key binding was pressed, with previously registered key binding |\n| `ready(version: [String])` | Sent on initialization of sweep peer |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faslpavel%2Fsweep-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faslpavel%2Fsweep-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faslpavel%2Fsweep-rs/lists"}