list.py (poetry-1.1.15) | : | list.py (poetry-1.2.0) | ||
---|---|---|---|---|
import os | from __future__ import annotations | |||
from ..command import Command | from poetry.config.config import Config | |||
from poetry.console.commands.command import Command | ||||
class CacheListCommand(Command): | class CacheListCommand(Command): | |||
name = "cache list" | ||||
name = "list" | ||||
description = "List Poetry's caches." | description = "List Poetry's caches." | |||
def handle(self): | def handle(self) -> int: | |||
from poetry.locations import REPOSITORY_CACHE_DIR | config = Config.create() | |||
if config.repository_cache_directory.exists(): | ||||
if os.path.exists(str(REPOSITORY_CACHE_DIR)): | caches = sorted(config.repository_cache_directory.iterdir()) | |||
caches = list(sorted(REPOSITORY_CACHE_DIR.iterdir())) | ||||
if caches: | if caches: | |||
for cache in caches: | for cache in caches: | |||
self.line("<info>{}</>".format(cache.name)) | self.line(f"<info>{cache.name}</>") | |||
return 0 | return 0 | |||
self.line("<warning>No caches found</>") | self.line_error("<warning>No caches found</>") | |||
return 0 | ||||
End of changes. 6 change blocks. | ||||
10 lines changed or deleted | 9 lines changed or added |