Add option to output full path of cache enty
@@ -37,11 +37,21 @@ class CacheCommand(Command):
usage = """
%prog dir
%prog info
- %prog list [<pattern>]
+ %prog list [<pattern>] [--abspath]
%prog remove <pattern>
%prog purge
"""
+ def add_options(self):
+ # type: () -> None
+ self.cmd_opts.add_option(
+ '--abspath',
+ dest='abspath',
+ action='store_true',
+ help='List the absolute path of wheels')
+
+ self.parser.insert_option_group(0, self.cmd_opts)
+
def run(self, options, args):
# type: (Values, List[Any]) -> int
handlers = {
@@ -118,6 +128,7 @@ class CacheCommand(Command):
files = self._find_wheels(options, pattern)
if not files:
+ if not options.abspath:
logger.info('Nothing cached.')
return
@@ -125,7 +136,11 @@ class CacheCommand(Command):
for filename in files:
wheel = os.path.basename(filename)
size = filesystem.format_file_size(filename)
+ if options.abspath:
+ results.append(filename)
+ else:
results.append(' - {} ({})'.format(wheel, size))
+ if not options.abspath:
logger.info('Cache contents:\n')
logger.info('\n'.join(sorted(results)))
