!7 //set flag LeanMode. p { S cmd = first(args); S archiveName = second(args); if (eqic(cmd, "x")) { print("Extracting"); if (empty(archiveName)) ret with print("Need archive name as second argument"); } else if (eqic(cmd, "c")) { print("Creating"); if (empty(archiveName)) ret with print("Need archive name as second argument"); } else if (eqic(cmd, "t")) { print("Listing"); if (empty(archiveName)) ret with print("Need archive name as second argument"); File f = newFile(archiveName); if (!fileExists(f)) ret with print("File not found: " + f.getAbsolutePath()); LineCompReader lcr = new(f); for (S version : lcr.versions()) print(" Found file: " + version //+ " (" + nLines(lcr.lineCountForVersion(version)) + ")"); + " (" + nBytes(lcr.byteCountForVersion(version)) + ")"); printWithPrecedingNL("Archive " + f.getAbsolutePath() + " stats:"); print(" " + str_toK_noSpace(lcr.totalByteCount()) + " of text compressed into " + str_toK_noSpace(l(f)) + ", uncompressed size " + " (" + nFiles(l(lcr.versions())) + ")"); } else { print(autoUnindent_mls([[ This is LINECOMP v0.1, a supercompressor for a bunch of similar text files. Commands: c archive.lc textFile1 textFile2 ... - create LINECOMP archive archive.lc from files x archive.lc - extract archive.lc to current directory t archive.lc - show contents of archive.lc ]])); } }