Skip to content

Commit 4ce62b2

Browse files
committed
cli/output(refactor[privacy]): Use PrivatePath in displays
1 parent b6925ec commit 4ce62b2

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

src/vcspull/cli/add.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from colorama import Fore, Style
1313

1414
from vcspull._internal.config_reader import DuplicateAwareConfigReader
15+
from vcspull._internal.private_path import PrivatePath
1516
from vcspull.config import (
1617
canonicalize_workspace_path,
1718
expand_dir,
@@ -21,7 +22,6 @@
2122
save_config_yaml_with_items,
2223
workspace_root_label,
2324
)
24-
from vcspull.util import contract_user_home
2525

2626
if t.TYPE_CHECKING:
2727
import argparse
@@ -238,7 +238,7 @@ def handle_add_command(args: argparse.Namespace) -> None:
238238
display_url, config_url = _normalize_detected_url(detected_remote)
239239

240240
if not config_url:
241-
display_url = contract_user_home(repo_path)
241+
display_url = str(PrivatePath(repo_path))
242242
config_url = str(repo_path)
243243
log.warning(
244244
"Unable to determine git remote for %s; using local path in config.",
@@ -262,7 +262,7 @@ def handle_add_command(args: argparse.Namespace) -> None:
262262

263263
summary_url = display_url or config_url
264264

265-
display_path = contract_user_home(repo_path)
265+
display_path = str(PrivatePath(repo_path))
266266

267267
log.info("%sFound new repository to import:%s", Fore.GREEN, Style.RESET_ALL)
268268
log.info(
@@ -370,7 +370,7 @@ def add_repo(
370370
config_file_path = pathlib.Path.cwd() / ".vcspull.yaml"
371371
log.info(
372372
"No config specified and no default found, will create at %s",
373-
contract_user_home(config_file_path),
373+
PrivatePath(config_file_path),
374374
)
375375
elif len(home_configs) > 1:
376376
log.error(
@@ -384,7 +384,7 @@ def add_repo(
384384
raw_config: dict[str, t.Any]
385385
duplicate_root_occurrences: dict[str, list[t.Any]]
386386
top_level_items: list[tuple[str, t.Any]]
387-
display_config_path = contract_user_home(config_file_path)
387+
display_config_path = str(PrivatePath(config_file_path))
388388

389389
if config_file_path.exists() and config_file_path.is_file():
390390
try:

src/vcspull/cli/list.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import logging
66
import typing as t
77

8+
from vcspull._internal.private_path import PrivatePath
89
from vcspull.config import filter_repos, find_config_files, load_configs
9-
from vcspull.util import contract_user_home
1010

1111
from ._colors import Colors, get_color_mode
1212
from ._output import OutputFormatter, get_output_mode
@@ -167,15 +167,15 @@ def _output_flat(
167167
{
168168
"name": repo_name,
169169
"url": str(repo_url),
170-
"path": contract_user_home(repo_path),
170+
"path": str(PrivatePath(repo_path)),
171171
"workspace_root": str(repo.get("workspace_root", "")),
172172
},
173173
)
174174

175175
# Human output (contract home directory for privacy/brevity)
176176
formatter.emit_text(
177177
f"{colors.muted('•')} {colors.info(repo_name)} "
178-
f"{colors.muted('→')} {contract_user_home(repo_path)}",
178+
f"{colors.muted('→')} {PrivatePath(repo_path)}",
179179
)
180180

181181

@@ -218,13 +218,13 @@ def _output_tree(
218218
{
219219
"name": repo_name,
220220
"url": str(repo_url),
221-
"path": contract_user_home(repo_path),
221+
"path": str(PrivatePath(repo_path)),
222222
"workspace_root": workspace,
223223
},
224224
)
225225

226226
# Human output: indented repo (contract home directory for privacy/brevity)
227227
formatter.emit_text(
228228
f" {colors.muted('•')} {colors.info(repo_name)} "
229-
f"{colors.muted('→')} {contract_user_home(repo_path)}",
229+
f"{colors.muted('→')} {PrivatePath(repo_path)}",
230230
)

src/vcspull/cli/status.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from dataclasses import dataclass
1414
from time import perf_counter
1515

16+
from vcspull._internal.private_path import PrivatePath
1617
from vcspull.config import filter_repos, find_config_files, load_configs
17-
from vcspull.util import contract_user_home
1818

1919
from ._colors import Colors, get_color_mode
2020
from ._output import OutputFormatter, get_output_mode
@@ -266,7 +266,7 @@ def check_repo_status(repo: ConfigDict, detailed: bool = False) -> dict[str, t.A
266266

267267
status: dict[str, t.Any] = {
268268
"name": repo_name,
269-
"path": contract_user_home(repo_path),
269+
"path": str(PrivatePath(repo_path)),
270270
"workspace_root": workspace_root,
271271
"exists": False,
272272
"is_git": False,
@@ -546,7 +546,7 @@ def _format_status_line(
546546

547547
if detailed:
548548
formatter.emit_text(
549-
f" {colors.muted('Path:')} {contract_user_home(status['path'])}",
549+
f" {colors.muted('Path:')} {PrivatePath(status['path'])}",
550550
)
551551
branch = status.get("branch")
552552
if branch:

src/vcspull/cli/sync.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
from libvcs.url import registry as url_tools
2424

2525
from vcspull import exc
26+
from vcspull._internal.private_path import PrivatePath
2627
from vcspull.config import filter_repos, find_config_files, load_configs
27-
from vcspull.util import contract_user_home
2828

2929
from ._colors import Colors, get_color_mode
3030
from ._output import (
@@ -264,7 +264,7 @@ def _build_plan_entry(
264264

265265
return PlanEntry(
266266
name=str(repo.get("name", "unknown")),
267-
path=contract_user_home(repo_path),
267+
path=str(PrivatePath(repo_path)),
268268
workspace_root=workspace_root,
269269
action=action,
270270
detail=detail,
@@ -436,7 +436,7 @@ def _render_plan(
436436
display_path = entry.path
437437
else:
438438
# Contract home directory for privacy/brevity in human output
439-
display_path = contract_user_home(display_path)
439+
display_path = str(PrivatePath(display_path))
440440

441441
detail_text = _format_detail_text(
442442
entry,
@@ -724,7 +724,7 @@ def silent_progress(output: str, timestamp: datetime) -> None:
724724
event: dict[str, t.Any] = {
725725
"reason": "sync",
726726
"name": repo_name,
727-
"path": contract_user_home(repo_path),
727+
"path": str(PrivatePath(repo_path)),
728728
"workspace_root": str(workspace_label),
729729
}
730730

0 commit comments

Comments
 (0)