Skip to content

Commit dcdb82c

Browse files
authored
feat,docs: Completion improvement, improve migrations docs (#403)
- `vcspull sync` file completion support for `-c` and `--config` + <kbd>tab</kbd> - Backport 1.13.0's notes to migration pages
2 parents b393aba + d4146cf commit dcdb82c

File tree

4 files changed

+114
-3
lines changed

4 files changed

+114
-3
lines changed

CHANGES

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,29 @@ $ pipx install --suffix=@next 'vcspull' --pip-args '\--pre' --force
2121

2222
<!-- Maintainers, insert changes / features for the next release here -->
2323

24+
## vcspull v1.15.4 (unreleased)
25+
26+
### CLI
27+
28+
- File completions for `-c` / `--config` files (#403)
29+
30+
After updating, you can re-run [shtab]'s setup (see [completions page]) completion of:
31+
32+
```console
33+
$ vcspull sync -c [tab]
34+
```
35+
36+
```console
37+
$ vcspull sync --config [tab]
38+
```
39+
40+
[completions page]: https://vcspull.git-pull.com/cli/completion.html
41+
[shtab]: https://docs.iterative.ai/shtab/
42+
43+
### Documentation
44+
45+
- Fix readme example for syncing repositories
46+
2447
## vcspull v1.15.3 (2022-10-09)
2548

2649
### Documentation

MIGRATION

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,27 @@ _Notes on the upcoming release will be added here_
2525

2626
<!-- Maintainers, insert changes / features for the next release here -->
2727

28+
## vcspull 1.15.4 (unreleased)
29+
30+
### Completions for `-c` / `--config` files
31+
32+
_via #403_
33+
34+
After updating, you can re-run [shtab]'s setup (see [completions page]) completion of:
35+
36+
```console
37+
$ vcspull sync -c [tab]
38+
```
39+
40+
```console
41+
$ vcspull sync --config [tab]
42+
```
43+
2844
## vcspull 1.15.0 (2022-10-09)
2945

30-
**Completions have changed** (#400)
46+
### Completions have changed
47+
48+
_via #400_
3149

3250
Completions now use a different tool: [shtab]. See the [completions page] for more information.
3351

@@ -36,6 +54,64 @@ If you were using earlier versions of vcspull (earlier than 1.15.0), you may nee
3654
[completions page]: https://vcspull.git-pull.com/cli/completion.html
3755
[shtab]: https://docs.iterative.ai/shtab/
3856

57+
## vcspull v1.13.0 (2022-09-25)
58+
59+
### Pulling all repositories
60+
61+
_via #394_
62+
63+
Empty command will now show help output
64+
65+
```console
66+
$ vcspull sync
67+
Usage: vcspull sync [OPTIONS] [REPO_TERMS]...
68+
69+
Options:
70+
-c, --config PATH Specify config
71+
-x, --exit-on-error Exit immediately when encountering an error syncing
72+
multiple repos
73+
-h, --help Show this message and exit.
74+
```
75+
76+
To achieve the equivalent behavior of syncing all repos, pass `'*'`:
77+
78+
```console
79+
$ vcspull sync '*'
80+
```
81+
82+
Depending on how shell escaping works in your shell setup with [wild card / asterisk], you may not need to quote `*`.
83+
84+
[wild card / asterisk]: https://tldp.org/LDP/abs/html/special-chars.html#:~:text=wild%20card%20%5Basterisk%5D.
85+
86+
### Terms with no match in config will show a notice
87+
88+
_via #394_
89+
90+
> No repo found in config(s) for "non_existent_repo"
91+
92+
- Syncing will now skip to the next repos if an error is encountered
93+
94+
- Learned `--exit-on-error` / `-x`
95+
96+
Usage:
97+
98+
```console
99+
$ vcspull sync --exit-on-error grako django
100+
```
101+
102+
Print traceback for errored repos:
103+
104+
```console
105+
$ vcspull --log-level DEBUG sync --exit-on-error grako django
106+
```
107+
108+
### Untracked files
109+
110+
_via https://github.com/vcs-python/libvcs/pull/425_
111+
112+
Syncing in git repositories with untracked files has been improved (via libvcs
113+
0.17)
114+
39115
<!---
40116
# vim: set filetype=markdown:
41117
-->

pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ types-PyYAML = "*"
106106
types-colorama = "*"
107107

108108
### Quirks ###
109-
importlib-metadata = "<5" # https://github.com/PyCQA/flake8/issues/1701
109+
importlib-metadata = "<5" # https://github.com/PyCQA/flake8/issues/1701
110110

111111
[tool.poetry.extras]
112112
docs = [
@@ -139,6 +139,12 @@ lint = [
139139
python_version = 3.9
140140
warn_unused_configs = true
141141

142+
[[tool.mypy.overrides]]
143+
module = [
144+
"shtab",
145+
]
146+
ignore_missing_imports = true
147+
142148
[tool.coverage.run]
143149
branch = true
144150
parallel = true

src/vcspull/cli/sync.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def clamp(n, _min, _max):
2121

2222

2323
def create_sync_subparser(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
24-
parser.add_argument("--config", "-c", help="specify config")
24+
config_file = parser.add_argument("--config", "-c", help="specify config")
2525
parser.add_argument(
2626
"repo_terms",
2727
nargs="+",
@@ -34,6 +34,12 @@ def create_sync_subparser(parser: argparse.ArgumentParser) -> argparse.ArgumentP
3434
dest="exit_on_error",
3535
help="exit immediately when encountering an error syncing multiple repos",
3636
)
37+
try:
38+
import shtab
39+
40+
config_file.complete = shtab.FILE # type: ignore
41+
except ImportError:
42+
pass
3743
return parser
3844

3945

0 commit comments

Comments
 (0)