r/CLI • u/ConsonantEcho • 14h ago
What should a CLI print when a batch stops halfway through?
Say a command is processing 100 files and fails on file 37. A stack trace might explain the crash, but it doesn’t tell me whether the first 36 writes stuck or whether rerunning will do them twice.
The output I’d want is something like: “36 saved, 1 failed, 63 not attempted.” Then tell me whether it’s safe to run again. I’d keep the full error available in verbose mode.
What’s a CLI that handles a partial failure well? I’m looking for examples where the output makes it obvious what to do next.
Drafted with AI assistance.
2
Upvotes
1
u/Temporary_Pie2733 8h ago
Less important than how it reports this information is how it records this information for its own use.
I wrote a system once that would atomically move files from one directory to another as it completed processing. If the processor exited for any reason, the files it had completed simply weren’t in its input directory any longer, and so couldn’t be processed again on restart.
1
u/hypnopixel 7h ago
consider keeping a transactional record of the files that are completed.