comicbox.readinglists.cli.run ¶
What every comicbox readinglist action shares.
The run that holds an action’s arguments, consoles and failures; the checks that keep a write off an input or an existing file; and the worker that makes Ctrl-C a clean cancel.
Run ¶
One command: its arguments, its consoles and whether anything failed.
Source code in comicbox/readinglists/cli/run.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 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 210 211 | |
exit_code property ¶
2 for a usage error, 1 when any file failed.
log_level property ¶
Get the logging level -Q asks for.
__init__(args) ¶
Hold the parsed arguments; open the consoles.
Source code in comicbox/readinglists/cli/run.py
136 137 138 139 140 141 142 143 144 145 146 | |
fail(path, error) ¶
Report one failure on stderr and carry on.
Source code in comicbox/readinglists/cli/run.py
154 155 156 157 | |
load(path) ¶
Read a list and report what the read dropped, or why it failed.
Source code in comicbox/readinglists/cli/run.py
164 165 166 167 168 169 170 171 172 | |
misuse(message) ¶
Report a usage error; the command exits 2.
Source code in comicbox/readinglists/cli/run.py
159 160 161 162 | |
no_keys(paths, lists) ¶
Say how many entries of each input can match nothing.
Source code in comicbox/readinglists/cli/run.py
196 197 198 199 200 201 202 203 204 205 206 | |
refuse(problems) ¶
Report every destination problem; whether there were any.
Source code in comicbox/readinglists/cli/run.py
174 175 176 177 178 | |
write(reading_list, fmt, path) ¶
Write a list to a file, or to stdout, after naming its losses.
Source code in comicbox/readinglists/cli/run.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
add_write_options(parser, output, help_text) ¶
Add --to, -o and --overwrite to an action.
Source code in comicbox/readinglists/cli/run.py
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | |
cancellable(run, cancel, call, cancelling=FETCH_CANCELLING) ¶
Run call on a worker so the first Ctrl-C cancels it cleanly.
The first Ctrl-C calls cancel and says cancelling; the work stops at its next safe point, which for a fetch can wait out one rate-limit window. A second Ctrl-C quits at once.
Source code in comicbox/readinglists/cli/run.py
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | |
destination_problems(destinations, inputs, *, overwrite, make_parents=False) ¶
Name each destination that is an input, shared, taken or unreachable.
Source code in comicbox/readinglists/cli/run.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
interrupts_ask(run, cancel) ¶
Make Ctrl-C only ask the writes to stop, however often it is pressed.
The first press calls cancel: no new write starts, and the writes under way finish. No press raises, so the process never exits with a write half done. Must be entered on the main thread.
Source code in comicbox/readinglists/cli/run.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | |
library_configs(*, delete_orig=False) ¶
Get the configs to read and to write a directory of comics with.
Both read every tag format a comic can carry, whatever read.formats says, so a tag file comicbox cannot parse is found wherever it is, and the formats written are built from all of the comic’s tags. The read config reads the file name as the user’s config says; the write config never does, so a write adds only the arc. Neither adds the config’s metadata, deletes its delete_keys or deletes all tags. delete_orig sets general.delete_orig for the writes, as the main CLI’s --delete-orig does.
Source code in comicbox/readinglists/cli/run.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
read_tagged_comics(run, directory, config=None) ¶
Read every comic under a directory, in path order.
A comic that cannot be read is one error line, and a directory one warning line; either way the command exits 1 and the rest are read.
Source code in comicbox/readinglists/cli/run.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
write_text(path, text) ¶
Write a UTF-8 file whole, or leave whatever was there.
Source code in comicbox/readinglists/cli/run.py
66 67 68 69 70 71 72 73 74 75 76 77 78 | |