Skip to content

Commit d985264

Browse files
committed
docs/cli(docs[search]): Document search command
why: Keep CLI documentation aligned with the new search subcommand. what: - add search command docs and API reference stubs - update CLI indexes and README examples
1 parent d0b2c8e commit d985264

File tree

5 files changed

+116
-1
lines changed

5 files changed

+116
-1
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ $ vcspull list --json | jq '.[].name'
136136
`--json` emits a single JSON array, while `--ndjson` streams newline-delimited
137137
objects that are easy to consume from shell pipelines.
138138

139+
Search across repositories with an rg-like query syntax:
140+
141+
```console
142+
$ vcspull search django
143+
$ vcspull search name:django url:github
144+
$ vcspull search --fixed-strings 'git+https://github.com/org/repo.git'
145+
```
146+
139147
### Check repository status
140148

141149
Get a quick health check for all configured workspaces:

docs/api/cli/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ sync
1212
add
1313
discover
1414
list
15+
search
1516
status
1617
fmt
1718
```

docs/api/cli/search.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# vcspull search - `vcspull.cli.search`
2+
3+
.. automodule:: vcspull.cli.search

docs/cli/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ sync
1010
add
1111
discover
1212
list
13+
search
1314
status
1415
fmt
1516
```
@@ -36,5 +37,5 @@ completion
3637
:nodescription:
3738
3839
subparser_name : @replace
39-
See :ref:`cli-sync`, :ref:`cli-add`, :ref:`cli-discover`, :ref:`cli-list`, :ref:`cli-status`, :ref:`cli-fmt`
40+
See :ref:`cli-sync`, :ref:`cli-add`, :ref:`cli-discover`, :ref:`cli-list`, :ref:`cli-search`, :ref:`cli-status`, :ref:`cli-fmt`
4041
```

docs/cli/search.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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

Comments
 (0)