Skip to content

comicbox.readinglists.cli.files

The actions on list files: print, validate, convert, combine, compare, from-arcs.

add_file_actions(actions)

Add the actions on list files to the parser’s subcommands.

Source code in comicbox/readinglists/cli/files.py
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
def add_file_actions(actions: Any) -> None:
    """Add the actions on list files to the parser's subcommands."""
    sub = actions.add_parser("print", help="Print each list as a table.")
    sub.add_argument("files", nargs="+", type=Path, metavar="FILE", help=_LIST_FILES)
    sub = actions.add_parser("validate", help="Check each file against its format.")
    sub.add_argument("files", nargs="+", type=Path, metavar="FILE", help=_LIST_FILES)
    sub = actions.add_parser("convert", help="Write each list in another format.")
    add_write_options(sub, "DIR", "Write here, not beside each input.")
    sub.add_argument("files", nargs="+", type=Path, metavar="FILE", help=_LIST_FILES)
    sub = actions.add_parser(
        "combine", help="Combine lists of one reading order, primary first."
    )
    add_write_options(sub, "FILE", "Write here, not to stdout.")
    sub.add_argument(
        "primary", type=Path, metavar="PRIMARY", help="The list whose order is kept."
    )
    sub.add_argument(
        "others",
        nargs="+",
        type=Path,
        metavar="OTHER",
        help="Lists of the same reading order, in rank order.",
    )
    sub = actions.add_parser("compare", help="Say whether two lists are the same list.")
    sub.add_argument("a", type=Path, metavar="A", help="A reading list file.")
    sub.add_argument("b", type=Path, metavar="B", help="Another reading list file.")
    sub = actions.add_parser(
        "from-arcs",
        help="Write one list per story arc the comics in DIR are tagged with.",
    )
    add_write_options(sub, "DIR", "Write here, not the current directory.")
    sub.add_argument(
        "directory", type=Path, metavar="DIR", help="Comics, searched deeply."
    )