Skip to content

Commit cf8813f

Browse files
committed
docs(cli): reflect duplicate-aware defaults succinctly
why: User-facing docs and README still describe the pre-merge behavior for add, discover, and fmt; guidance should mention the new defaults without drowning out other tips. what: - note that fmt merges duplicate workspace roots unless --no-merge is supplied - explain path-based adds, confirmation flags, and duplicate handling in docs/cli/add.md and the README bullet list - mention discover's default merge behavior with a concise pointer to --no-merge
1 parent bd66efe commit cf8813f

File tree

4 files changed

+32
-14
lines changed

4 files changed

+32
-14
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ $ vcspull add my-lib https://github.com/example/my-lib.git --path ~/code/my-lib
104104
`-w ~/projects/libs`.
105105
- Pass `-f/--file` to add to an alternate YAML file.
106106
- Use `--dry-run` to preview changes before writing.
107+
- Point at an existing checkout (`vcspull add ~/projects/example`) to infer the
108+
name and remote; add `--yes` to skip the confirmation prompt.
109+
- Append `--no-merge` if you prefer to review duplicate workspace roots
110+
yourself instead of having vcspull merge them automatically.
107111
- Follow with `vcspull sync my-lib` to clone or update the working tree after registration.
108112

109113
### Discover local checkouts and add en masse
@@ -116,8 +120,9 @@ $ vcspull discover ~/code --recursive
116120
```
117121

118122
The scan shows each repository before import unless you opt into `--yes`. Add
119-
`-w ~/code/` to pin the resulting workspace root or `-f` to
120-
write somewhere other than the default `~/.vcspull.yaml`.
123+
`-w ~/code/` to pin the resulting workspace root or `-f` to write somewhere other
124+
than the default `~/.vcspull.yaml`. Duplicate workspace roots are merged by
125+
default; include `--no-merge` to keep them separate while you review the log.
121126

122127
### Inspect configured repositories
123128

@@ -148,15 +153,16 @@ command for automation workflows.
148153

149154
### Normalize configuration files
150155

151-
After importing or editing by hand, run the formatter to tidy up keys and keep
152-
entries sorted:
156+
After importing or editing by hand, run the formatter to tidy up keys, merge
157+
duplicate workspace sections, and keep entries sorted:
153158

154159
```console
155160
$ vcspull fmt -f ~/.vcspull.yaml --write
156161
```
157162

158163
Use `vcspull fmt --all --write` to format every YAML file that vcspull can
159-
discover under the standard config locations.
164+
discover under the standard config locations. Add `--no-merge` if you only want
165+
duplicate roots reported, not rewritten.
160166

161167
## Sync your repos
162168

docs/cli/add.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ The `--path` flag is useful when:
6363
- Using non-standard directory layouts
6464
- The repository name doesn't match the desired directory name
6565

66+
You can also point `vcspull add` at an existing checkout. Supplying a path such
67+
as `vcspull add ~/projects/example` infers the repository name, inspects its
68+
`origin` remote, and prompts before writing. Add `--yes` when you need to skip
69+
the confirmation in scripts.
70+
6671
## Choosing configuration files
6772

6873
By default, vcspull looks for the first YAML configuration file in:
@@ -142,14 +147,10 @@ $ vcspull add tooling https://github.com/company/tooling.git \
142147

143148
## Handling duplicates
144149

145-
If a repository with the same name already exists in the workspace, vcspull will warn you:
146-
147-
```console
148-
$ vcspull add flask https://github.com/pallets/flask.git -w ~/code/
149-
WARNING: Repository 'flask' already exists in workspace '~/code/'.
150-
```
151-
152-
The existing entry is preserved and not overwritten.
150+
vcspull merges duplicate workspace sections by default so existing repositories
151+
stay intact. When conflicts appear, the command logs what it kept. Prefer to
152+
resolve duplicates yourself? Pass `--no-merge` to leave every section untouched
153+
while still surfacing warnings.
153154

154155
## After adding repositories
155156

docs/cli/discover.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ Scan complete: 2 repositories added, 0 skipped
4545
```
4646

4747
The command prompts for each repository before adding it to your configuration.
48+
When a matching workspace section already exists, vcspull merges the new entry
49+
into it so previously tracked repositories stay intact. Prefer to review
50+
duplicates yourself? Add `--no-merge` to keep every section untouched while
51+
still seeing a warning.
4852

4953
## Recursive scanning
5054

docs/cli/fmt.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
entries stay consistent. By default the formatter prints the proposed changes to
77
stdout. Apply the updates in place with `--write`.
88

9+
When duplicate workspace roots are encountered, the formatter merges them into a
10+
single section so repositories are never dropped. Prefer to review duplicates
11+
without rewriting them? Pass `--no-merge` to leave the original sections in
12+
place while still showing a warning.
13+
914
## Command
1015

1116
```{eval-rst}
@@ -19,12 +24,14 @@ stdout. Apply the updates in place with `--write`.
1924

2025
## What gets formatted
2126

22-
The formatter performs three main tasks:
27+
The formatter performs four main tasks:
2328

2429
- Expands string-only entries into verbose dictionaries using the `repo` key.
2530
- Converts legacy `url` keys to `repo` for consistency with the rest of the
2631
tooling.
2732
- Sorts directory keys and repository names alphabetically to minimize diffs.
33+
- Consolidates duplicate workspace roots into a single merged section while
34+
logging any conflicts.
2835

2936
For example:
3037

0 commit comments

Comments
 (0)