|
| 1 | +(cli-search)= |
| 2 | + |
| 3 | +# vcspull search |
| 4 | + |
| 5 | +The `vcspull search` command looks up repositories across your vcspull |
| 6 | +configuration with an rg-like query syntax. Queries are regex by default, can |
| 7 | +scope to specific fields, and can emit structured JSON for automation. |
| 8 | + |
| 9 | +## Command |
| 10 | + |
| 11 | +```{eval-rst} |
| 12 | +.. argparse:: |
| 13 | + :module: vcspull.cli |
| 14 | + :func: create_parser |
| 15 | + :prog: vcspull |
| 16 | + :path: search |
| 17 | + :nodescription: |
| 18 | +``` |
| 19 | + |
| 20 | +## Basic usage |
| 21 | + |
| 22 | +Search all fields (name, path, url, workspace) with regex: |
| 23 | + |
| 24 | +```console |
| 25 | +$ vcspull search django |
| 26 | +• django → ~/code/django |
| 27 | +``` |
| 28 | + |
| 29 | +## Field-scoped queries |
| 30 | + |
| 31 | +Target specific fields with prefixes: |
| 32 | + |
| 33 | +```console |
| 34 | +$ vcspull search name:django url:github |
| 35 | +• django → ~/code/django |
| 36 | + url: git+https://github.com/django/django.git |
| 37 | +``` |
| 38 | + |
| 39 | +Available field prefixes: |
| 40 | +- `name:` |
| 41 | +- `path:` |
| 42 | +- `url:` |
| 43 | +- `workspace:` (alias: `root:` or `ws:`) |
| 44 | + |
| 45 | +## Literal matches |
| 46 | + |
| 47 | +Use `-F/--fixed-strings` to match literal text instead of regex: |
| 48 | + |
| 49 | +```console |
| 50 | +$ vcspull search --fixed-strings 'git+https://github.com/org/repo.git' |
| 51 | +``` |
| 52 | + |
| 53 | +## Case handling |
| 54 | + |
| 55 | +`-i/--ignore-case` forces case-insensitive matching. `-S/--smart-case` matches |
| 56 | +case-insensitively unless your query includes uppercase characters. |
| 57 | + |
| 58 | +```console |
| 59 | +$ vcspull search -S Django |
| 60 | +``` |
| 61 | + |
| 62 | +## Boolean matching |
| 63 | + |
| 64 | +By default all terms must match. Use `--any` to match if *any* term matches: |
| 65 | + |
| 66 | +```console |
| 67 | +$ vcspull search --any django flask |
| 68 | +``` |
| 69 | + |
| 70 | +Invert matches with `-v/--invert-match`: |
| 71 | + |
| 72 | +```console |
| 73 | +$ vcspull search -v --fixed-strings github |
| 74 | +``` |
| 75 | + |
| 76 | +## JSON output |
| 77 | + |
| 78 | +Emit matches as JSON for automation: |
| 79 | + |
| 80 | +```console |
| 81 | +$ vcspull search --json django |
| 82 | +``` |
| 83 | + |
| 84 | +Output format: |
| 85 | + |
| 86 | +```json |
| 87 | +[ |
| 88 | + { |
| 89 | + "name": "django", |
| 90 | + "url": "git+https://github.com/django/django.git", |
| 91 | + "path": "~/code/django", |
| 92 | + "workspace_root": "~/code/", |
| 93 | + "matched_fields": ["name", "url"] |
| 94 | + } |
| 95 | +] |
| 96 | +``` |
| 97 | + |
| 98 | +Use NDJSON for streaming: |
| 99 | + |
| 100 | +```console |
| 101 | +$ vcspull search --ndjson django |
| 102 | +``` |
0 commit comments