def add_comic_actions(actions: Any) -> None:
"""Add the actions on a directory of comics to the parser's subcommands."""
sub = actions.add_parser(
"match",
help="Say which of a list's issues the comics in DIR are, and which are missing.",
description=(
"Find each of a list's issues among the comics in DIR: by an issue id,"
" then by series, year or volume and issue, then by a variant of the"
" series name. Each comic found is a row, with how it was found."
" Linked directories are not searched."
),
)
sub.add_argument("file", type=Path, metavar="FILE", help="The reading list.")
sub.add_argument(
"directory", type=Path, metavar="DIR", help="Comics, searched deeply."
)
sub = actions.add_parser(
"write-arcs",
help="Tag the comics in DIR a list matches with its story arc; a dry run without --apply.",
description=(
"Tag each comic in DIR that a list matches with the list's name as a"
" story arc, numbered by its place in an ordered list. Without --apply"
" nothing is written: each comic's change is shown. Only comics"
" matched by id or by series, year or volume and issue are tagged,"
" unless --variants. A comic that already has the arc with that number"
" is left alone, as is one with a tag file comicbox cannot read. A"
" CBR, CBT or CB7 is converted to a CBZ beside it, as comicbox converts"
" it, and is not written when that CBZ already exists."
),
)
sub.add_argument(
"-w",
"--write",
action=CSVAction,
required=True,
metavar="FORMATS",
dest="formats",
help=(
"The tag formats to write, as comicbox -w takes them: cix, mi,"
" json... Each must be able to hold the arc. Every other tag file a"
" comic has is removed, and each comic's line names them, unless keep"
" is among them: -w keep writes each comic in the formats it has, and"
" -w cix,keep adds ComicInfo to them."
),
)
sub.add_argument(
"--delete-orig",
action="store_true",
help=(
"Delete a CBR, CBT or CB7 once it is converted to a CBZ, as comicbox"
" --delete-orig does."
),
)
sub.add_argument(
"--variants",
action="store_true",
help="Also tag the comics found only by a variant of the series name.",
)
sub.add_argument(
"--apply",
action="store_true",
help="Write the arcs. Without it, only show what would change.",
)
sub.add_argument("file", type=Path, metavar="FILE", help="The reading list.")
sub.add_argument(
"directory", type=Path, metavar="DIR", help="Comics, searched deeply."
)