|
@@ -3,7 +3,7 @@ import logging
|
|
|
|
|
|
from ._common import with_repository
|
|
|
from ..constants import * # NOQA
|
|
|
-from ..helpers import format_archive, CommandError, bin_to_hex
|
|
|
+from ..helpers import format_archive, CommandError, bin_to_hex, archivename_validator
|
|
|
from ..manifest import Manifest
|
|
|
|
|
|
from ..logger import create_logger
|
|
@@ -18,11 +18,14 @@ class DeleteMixIn:
|
|
|
self.output_list = args.output_list
|
|
|
dry_run = args.dry_run
|
|
|
manifest = Manifest.load(repository, (Manifest.Operation.DELETE,))
|
|
|
- archive_infos = manifest.archives.list_considering(args)
|
|
|
+ if args.name:
|
|
|
+ archive_infos = [manifest.archives.get_one(args.name)]
|
|
|
+ else:
|
|
|
+ archive_infos = manifest.archives.list_considering(args)
|
|
|
count = len(archive_infos)
|
|
|
if count == 0:
|
|
|
return
|
|
|
- if args.match_archives is None and args.first == 0 and args.last == 0:
|
|
|
+ if not args.name and args.match_archives is None and args.first == 0 and args.last == 0:
|
|
|
raise CommandError(
|
|
|
"Aborting: if you really want to delete all archives, please use -a 'sh:*' "
|
|
|
"or just delete the whole repository (might be much faster)."
|
|
@@ -85,3 +88,6 @@ class DeleteMixIn:
|
|
|
"--list", dest="output_list", action="store_true", help="output verbose list of archives"
|
|
|
)
|
|
|
define_archive_filters_group(subparser)
|
|
|
+ subparser.add_argument(
|
|
|
+ "name", metavar="NAME", nargs="?", type=archivename_validator, help="specify the archive name"
|
|
|
+ )
|