Skip to content

Commit 4ca8159

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

8 files changed

Lines changed: 187 additions & 135 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
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`
3636

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

README.md

Lines changed: 3 additions & 3 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`.
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,7 +115,7 @@ $ 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
118+
`--workspace-root ~/code/` to pin the resulting workspace root or `--config` to
119119
write somewhere other than the default `~/.vcspull.yaml`.
120120

121121
### Normalize configuration files

docs/cli/import.md

Lines changed: 9 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,18 @@ 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.
5153
- `--yes`/`-y` accepts every suggestion, which is useful for unattended
5254
migrations.
5355

docs/quickstart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ 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. After editing or
118+
importing, run `vcspull fmt --write` (documented in {ref}`cli-fmt`) to
119119
normalize keys and keep your configuration tidy.
120120

121121
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)