Commit 78bd193
committed
cli(add[url]) Accept a URL as the add argument
why: Declaring a repository that is not checked out yet required
hand-editing the YAML. `vcspull add` gated on the path existing, and
`--url` only overrode the remote detected from a checkout, so there was
no CLI route from "I know the URL" to a config entry. URL-first adding
existed as `vcspull import <name> <url>` through v1.39 and was dropped
when `add` became path-first; `import` now belongs to the forge
importers, so the capability comes back on `add` instead.
what:
- Accept either a filesystem path or a repository URL as the `add`
argument, discriminated with libvcs `GitURL.is_valid`
- Resolve an existing directory before considering a URL, so every
path-mode invocation keeps its current behavior
- Derive the repo name from the URL basename, still overridable with
`--name`; reject a URL argument combined with `--url`
- Offer workspace roots already declared in the config when a URL has
no `--workspace`, defaulting to the first and falling back to the
current directory; fold the choice into the existing confirm prompt
- Extract config-file resolution into `_resolve_config_file` so the
prompt can read declared roots before the write path runs
- Cover URL forms, root selection, decline paths, and path-wins
precedence in tests/cli/test_add.py1 parent 3750b3e commit 78bd193
2 files changed
Lines changed: 586 additions & 56 deletions
0 commit comments