Skip to content

Commit 1ad8333

Browse files
committed
cli(import): standardize workspace root terminology
1 parent ec0c1e6 commit 1ad8333

8 files changed

Lines changed: 197 additions & 134 deletions

File tree

CHANGES

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ _Notes on upcoming releases will be added here_
2828
#### New command: `vcspull import` (#465)
2929

3030
- **Manual import**: Register a single repository with `vcspull import <name> <url>`
31-
- Optional `--dir`/`--path` helpers for base-directory detection
31+
- Optional `--workspace-root`/`--path` helpers for workspace-root detection (with legacy `--dir` alias)
3232
- **Filesystem scan**: Discover and import existing repositories with `vcspull import --scan <dir>`
3333
- Recursively scan with `--recursive`/`-r`
3434
- Interactive confirmation prompt or `--yes` for unattended runs
35-
- Custom base directory with `--base-dir-key`
35+
- Custom workspace root with `--workspace-root` (legacy `--dir`/`--base-dir-key` aliases)
3636

3737
#### New command: `vcspull fmt` (#465)
3838

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ $ vcspull import my-lib https://github.com/example/my-lib.git --path ~/code/my-l
100100
```
101101

102102
- Omit `--path` to default the entry under `./`.
103-
- Use `--dir` when you want to force a specific base-directory key, e.g.
104-
`--dir ~/projects/libs`.
103+
- Use `--workspace-root` when you want to force a specific workspace root, e.g.
104+
`--workspace-root ~/projects/libs` (the legacy `--dir` alias still works).
105105
- Pass `-c/--config` to import into an alternate YAML file.
106106
- Follow with `vcspull sync my-lib` to clone or update the working tree after registration.
107107

@@ -115,8 +115,9 @@ $ vcspull import --scan ~/code --recursive
115115
```
116116

117117
The scan shows each repository before import unless you opt into `--yes`. Add
118-
`--base-dir-key ~/code/` to pin the resulting section name or `--config` to
119-
write somewhere other than the default `~/.vcspull.yaml`.
118+
`--workspace-root ~/code/` to pin the resulting workspace root or `--config` to
119+
write somewhere other than the default `~/.vcspull.yaml` (aliases `--dir` and
120+
`--base-dir-key` remain available for compatibility).
120121

121122
### Normalize configuration files
122123

docs/cli/import.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ directories for Git repositories that already live on disk.
2121

2222
Provide a repository name and remote URL to append an entry to your
2323
configuration. Use `--path` when you already have a working tree on disk so the
24-
configured base directory matches its location. Override the inferred base
25-
directory with `--dir` when you need a specific configuration key.
24+
inferred workspace root matches its location. Override the detected workspace
25+
root with `--workspace-root` when you need to target a specific directory.
2626

2727
```console
2828
$ vcspull import my-lib https://github.com/example/my-lib.git --path ~/code/my-lib
29+
$ vcspull import another-lib https://github.com/example/another-lib.git \
30+
--workspace-root ~/code
2931
```
3032

3133
With no `-c/--config` flag vcspull looks for the first YAML configuration file
@@ -36,18 +38,19 @@ new `.vcspull.yaml` is created next to where you run the command.
3638

3739
`vcspull import --scan` discovers Git repositories that already exist on disk
3840
and writes them to your configuration. The command prompts before adding each
39-
repository, showing the inferred name, directory key, and origin URL (when
41+
repository, showing the inferred name, workspace root, and origin URL (when
4042
available).
4143

4244
```console
4345
$ vcspull import --scan ~/code --recursive
44-
? Add ~/code/vcspull (dir: ~/code/)? [y/N]: y
45-
? Add ~/code/libvcs (dir: ~/code/)? [y/N]: y
46+
? Add ~/code/vcspull (workspace root: ~/code/)? [y/N]: y
47+
? Add ~/code/libvcs (workspace root: ~/code/)? [y/N]: y
4648
```
4749

4850
- `--recursive`/`-r` searches nested directories.
49-
- `--base-dir-key` forces all discovered repositories to use the same base
50-
directory key, overriding the automatically expanded directory.
51+
- `--workspace-root` forces all discovered repositories to use the same
52+
workspace root, overriding the directory inferred from their location (the
53+
legacy `--dir` and `--base-dir-key` aliases still work).
5154
- `--yes`/`-y` accepts every suggestion, which is useful for unattended
5255
migrations.
5356

docs/quickstart.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ YAML? Create a `~/.vcspull.yaml` file:
114114
Already have repositories cloned locally? Use
115115
`vcspull import --scan ~/code --recursive` to detect existing Git checkouts and
116116
append them to your configuration. See {ref}`cli-import` for more details and
117-
options such as `--base-dir-key` and `--yes` for unattended runs. After editing
118-
or importing, run `vcspull fmt --write` (documented in {ref}`cli-fmt`) to
117+
options such as `--workspace-root` and `--yes` for unattended runs (the legacy
118+
`--dir` and `--base-dir-key` aliases continue to work). After editing or
119+
importing, run `vcspull fmt --write` (documented in {ref}`cli-fmt`) to
119120
normalize keys and keep your configuration tidy.
120121

121122
The `git+` in front of the repository URL. Mercurial repositories use

src/vcspull/cli/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def cli(_args: list[str] | None = None) -> None:
132132
scan_dir_str=args.scan_dir,
133133
config_file_path_str=args.config,
134134
recursive=args.recursive,
135-
base_dir_key_arg=args.base_dir_key,
135+
workspace_root_override=args.workspace_root_path,
136136
yes=args.yes,
137137
)
138138
elif args.name and args.url:
@@ -142,7 +142,7 @@ def cli(_args: list[str] | None = None) -> None:
142142
url=args.url,
143143
config_file_path_str=args.config,
144144
path=args.path,
145-
base_dir=args.base_dir,
145+
workspace_root_path=args.workspace_root_path,
146146
)
147147
else:
148148
# Error: need either name+url or --scan

0 commit comments

Comments
 (0)