Skip to content

Commit 3cd3724

Browse files
authored
refactor!(CLI): Param naming tweak (#406)
2 parents 1e129b9 + 99634e1 commit 3cd3724

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

CHANGES

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

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

24+
### Internal
25+
26+
- `sync()`: Rename `repo_terms` to `repo_patterns` (#406)
27+
2428
## vcspull v1.15.8 (2022-10-16)
2529

2630
### CLI

src/vcspull/cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def cli(args=None):
7575
return
7676
elif args.subparser_name == "sync":
7777
sync(
78-
repo_terms=args.repo_terms,
78+
repo_patterns=args.repo_patterns,
7979
config=args.config,
8080
exit_on_error=args.exit_on_error,
8181
parser=sync_parser,

src/vcspull/cli/sync.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def create_sync_subparser(parser: argparse.ArgumentParser) -> argparse.ArgumentP
2828
help="optional filepath to specify vcspull config",
2929
)
3030
parser.add_argument(
31-
"repo_terms",
31+
"repo_patterns",
3232
metavar="filter",
3333
nargs="*",
3434
help="patterns / terms of repos, accepts globs / fnmatch(3)",
@@ -51,14 +51,14 @@ def create_sync_subparser(parser: argparse.ArgumentParser) -> argparse.ArgumentP
5151

5252

5353
def sync(
54-
repo_terms,
54+
repo_patterns,
5555
config,
5656
exit_on_error: bool,
5757
parser: t.Optional[
5858
argparse.ArgumentParser
5959
] = None, # optional so sync can be unit tested
6060
) -> None:
61-
if isinstance(repo_terms, list) and len(repo_terms) == 0:
61+
if isinstance(repo_patterns, list) and len(repo_patterns) == 0:
6262
if parser is not None:
6363
parser.print_help()
6464
sys.exit(2)
@@ -69,14 +69,14 @@ def sync(
6969
configs = load_configs(find_config_files(include_home=True))
7070
found_repos = []
7171

72-
for repo_term in repo_terms:
72+
for repo_pattern in repo_patterns:
7373
dir, vcs_url, name = None, None, None
74-
if any(repo_term.startswith(n) for n in ["./", "/", "~", "$HOME"]):
75-
dir = repo_term
76-
elif any(repo_term.startswith(n) for n in ["http", "git", "svn", "hg"]):
77-
vcs_url = repo_term
74+
if any(repo_pattern.startswith(n) for n in ["./", "/", "~", "$HOME"]):
75+
dir = repo_pattern
76+
elif any(repo_pattern.startswith(n) for n in ["http", "git", "svn", "hg"]):
77+
vcs_url = repo_pattern
7878
else:
79-
name = repo_term
79+
name = repo_pattern
8080

8181
# collect the repos from the config files
8282
found = filter_repos(configs, dir=dir, vcs_url=vcs_url, name=name)

0 commit comments

Comments
 (0)