From d2aebbf7f901d1e6ea27a16c410bd2faea24c55d Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 16 Oct 2022 14:13:56 -0500 Subject: [PATCH 1/5] ci(mypy): Ignore shtab --- pyproject.toml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2b7c602c..52e2ecae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,7 +106,7 @@ types-PyYAML = "*" types-colorama = "*" ### Quirks ### -importlib-metadata = "<5" # https://github.com/PyCQA/flake8/issues/1701 +importlib-metadata = "<5" # https://github.com/PyCQA/flake8/issues/1701 [tool.poetry.extras] docs = [ @@ -139,6 +139,12 @@ lint = [ python_version = 3.9 warn_unused_configs = true +[[tool.mypy.overrides]] +module = [ + "shtab", +] +ignore_missing_imports = true + [tool.coverage.run] branch = true parallel = true From ccb2e8102f57e806f389b667e743b457a2d7ef98 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 16 Oct 2022 14:20:00 -0500 Subject: [PATCH 2/5] feat(cli[sync]): Add file lookup for config file --- src/vcspull/cli/sync.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/vcspull/cli/sync.py b/src/vcspull/cli/sync.py index 3b5f87ff..3e3fa389 100644 --- a/src/vcspull/cli/sync.py +++ b/src/vcspull/cli/sync.py @@ -21,7 +21,7 @@ def clamp(n, _min, _max): def create_sync_subparser(parser: argparse.ArgumentParser) -> argparse.ArgumentParser: - parser.add_argument("--config", "-c", help="specify config") + config_file = parser.add_argument("--config", "-c", help="specify config") parser.add_argument( "repo_terms", nargs="+", @@ -34,6 +34,12 @@ def create_sync_subparser(parser: argparse.ArgumentParser) -> argparse.ArgumentP dest="exit_on_error", help="exit immediately when encountering an error syncing multiple repos", ) + try: + import shtab + + config_file.complete = shtab.FILE # type: ignore + except ImportError: + pass return parser From 39103b29961ea739752b1d7ea29467165af1ddb3 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 16 Oct 2022 14:25:22 -0500 Subject: [PATCH 3/5] docs(MIGRATION): Back v1.13.0 behavioral notes --- MIGRATION | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/MIGRATION b/MIGRATION index e8f01606..727f6fa7 100644 --- a/MIGRATION +++ b/MIGRATION @@ -27,7 +27,7 @@ _Notes on the upcoming release will be added here_ ## vcspull 1.15.0 (2022-10-09) -**Completions have changed** (#400) +### Completions have changed (#400) Completions now use a different tool: [shtab]. See the [completions page] for more information. @@ -36,6 +36,58 @@ If you were using earlier versions of vcspull (earlier than 1.15.0), you may nee [completions page]: https://vcspull.git-pull.com/cli/completion.html [shtab]: https://docs.iterative.ai/shtab/ +## vcspull v1.13.0 (2022-09-25) + +### Pulling all repositories + +Empty command will now show help output + +```console +$ vcspull sync +Usage: vcspull sync [OPTIONS] [REPO_TERMS]... + +Options: +-c, --config PATH Specify config +-x, --exit-on-error Exit immediately when encountering an error syncing +multiple repos +-h, --help Show this message and exit. +``` + +To achieve the equivalent behavior of syncing all repos, pass `'*'`: + +```console +$ vcspull sync '*' +``` + +Depending on how shell escaping works in your shell setup with [wild card / asterisk], you may not need to quote `*`. + +[wild card / asterisk]: https://tldp.org/LDP/abs/html/special-chars.html#:~:text=wild%20card%20%5Basterisk%5D. + +### Terms with no match in config will show a notice + +> No repo found in config(s) for "non_existent_repo" + +- Syncing will now skip to the next repos if an error is encountered + +- Learned `--exit-on-error` / `-x` + +Usage: + +```console +$ vcspull sync --exit-on-error grako django +``` + +Print traceback for errored repos: + +```console +$ vcspull --log-level DEBUG sync --exit-on-error grako django +``` + +### Untracked files + +Syncing in git repositories with untracked files has been improved (via libvcs +0.17, https://github.com/vcs-python/libvcs/pull/425) + From 853ecc0d4cf8a498e569b6c0236331302ebe709b Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 16 Oct 2022 14:29:40 -0500 Subject: [PATCH 4/5] docs(MIGRATION) Note vcspull sync completion update --- MIGRATION | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/MIGRATION b/MIGRATION index 727f6fa7..997d4d35 100644 --- a/MIGRATION +++ b/MIGRATION @@ -25,9 +25,27 @@ _Notes on the upcoming release will be added here_ +## vcspull 1.15.4 (unreleased) + +### Completions for `-c` / `--config` files + +_via #403_ + +After updating, you can re-run [shtab]'s setup (see [completions page]) completion of: + +```console +$ vcspull sync -c [tab] +``` + +```console +$ vcspull sync --config [tab] +``` + ## vcspull 1.15.0 (2022-10-09) -### Completions have changed (#400) +### Completions have changed + +_via #400_ Completions now use a different tool: [shtab]. See the [completions page] for more information. @@ -40,6 +58,8 @@ If you were using earlier versions of vcspull (earlier than 1.15.0), you may nee ### Pulling all repositories +_via #394_ + Empty command will now show help output ```console @@ -65,6 +85,8 @@ Depending on how shell escaping works in your shell setup with [wild card / aste ### Terms with no match in config will show a notice +_via #394_ + > No repo found in config(s) for "non_existent_repo" - Syncing will now skip to the next repos if an error is encountered @@ -85,8 +107,10 @@ $ vcspull --log-level DEBUG sync --exit-on-error grako django ### Untracked files +_via https://github.com/vcs-python/libvcs/pull/425_ + Syncing in git repositories with untracked files has been improved (via libvcs -0.17, https://github.com/vcs-python/libvcs/pull/425) +0.17) +## vcspull v1.15.4 (unreleased) + +### CLI + +- File completions for `-c` / `--config` files (#403) + + After updating, you can re-run [shtab]'s setup (see [completions page]) completion of: + + ```console + $ vcspull sync -c [tab] + ``` + + ```console + $ vcspull sync --config [tab] + ``` + +[completions page]: https://vcspull.git-pull.com/cli/completion.html +[shtab]: https://docs.iterative.ai/shtab/ + +### Documentation + +- Fix readme example for syncing repositories + ## vcspull v1.15.3 (2022-10-09) ### Documentation