Skip to content

Commit 247ca24

Browse files
committed
Improve help page
1 parent 15c4302 commit 247ca24

File tree

1 file changed

+85
-13
lines changed

1 file changed

+85
-13
lines changed

src/app/Kanzi.cpp

Lines changed: 85 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,21 @@ void printHelp(Printer& log, const string& mode, bool showHeader)
7474

7575
log.println(APP_USAGE, true);
7676
log.println("", true);
77-
log.println("Credits: Matt Mahoney, Yann Collet, Jan Ondrus, Yuta Mori, Ilya Muravyov,", true);
78-
log.println(" Neal Burns, Fabian Giesen, Jarek Duda, Ilya Grebnov", true);
79-
log.println("", true);
77+
log.println("Options\n", true);
8078
log.println(" -h, --help", true);
81-
log.println(" Display this message\n", true);
8279

8380
if ((mode.compare(0, 1, "c") != 0) && (mode.compare(0, 1, "d") != 0)) {
81+
log.println(" Display this message.", true);
82+
log.println(" Use in conjunction with -c to print information for compression,", true);
83+
log.println(" or -d to print information for decompression.\n", true);
8484
log.println(" -c, --compress", true);
8585
log.println(" Compress mode\n", true);
8686
log.println(" -d, --decompress", true);
8787
log.println(" Decompress mode\n", true);
8888
}
89+
else {
90+
log.println(" Display this message.\n", true);
91+
}
8992

9093
log.println(" -i, --input=<inputName>", true);
9194
log.println(" Name of the input file or directory or 'stdin'", true);
@@ -162,7 +165,14 @@ void printHelp(Printer& log, const string& mode, bool showHeader)
162165
log.println(" -f, --force", true);
163166
log.println(" Overwrite the output file if it already exists\n", true);
164167
log.println(" --rm", true);
165-
log.println(" Remove the input file after successful (de)compression.", true);
168+
169+
if (mode.compare(0, 1, "c") == 0) {
170+
log.println(" Remove the input file after successful compression.", true);
171+
}
172+
else {
173+
log.println(" Remove the input file after successful decompression.", true);
174+
}
175+
166176
log.println(" If the input is a folder, all processed files under the folder are removed.\n", true);
167177
log.println(" --no-link", true);
168178
log.println(" Skip links\n", true);
@@ -176,17 +186,77 @@ void printHelp(Printer& log, const string& mode, bool showHeader)
176186
log.println(" --to=blockId", true);
177187
log.println(" Decompress ending at the provided block (excluded).\n", true);
178188
log.println("", true);
179-
log.println("EG. kanzi -d -i foo.knz -f -v 2 -j 2\n", true);
180-
log.println("EG. kanzi --decompress --input=foo.knz --force --verbose=2 --jobs=2\n", true);
189+
log.println("Examples\n", true);
190+
log.println(" kanzi -d -i foo.knz -f -v 2 -j 2\n", true);
191+
log.println(" kanzi --decompress --input=foo.knz --force --verbose=2 --jobs=2\n", true);
181192
}
182193

183194
if (mode.compare(0, 1, "c") == 0) {
184195
log.println("", true);
185-
log.println("EG. kanzi -c -i foo.txt -o none -b 4m -l 4 -v 3\n", true);
186-
log.println("EG. kanzi -c -i foo.txt -f -t BWT+MTFT+ZRLT -b 4m -e FPAQ -j 4\n", true);
187-
log.println("EG. kanzi --compress --input=foo.txt --output=foo.knz --force", true);
188-
log.println(" --transform=BWT+MTFT+ZRLT --block=4m --entropy=FPAQ --jobs=4\n", true);
196+
log.println("Transforms\n", true);
197+
log.println(" BWT: Burrows Wheeler Transform is a transform that reorders symbols", true);
198+
log.println(" in a reversible way that is more amenable to entropy coding.", true);
199+
log.println(" This implementation uses a linear time foward transform and parallel", true);
200+
log.println(" inverse tranform.\n", true);
201+
log.println(" BWTS: Burrows Wheeler Transform by Scott is a bijective variant of the BWT.\n", true);
202+
log.println(" LZ: Lempel Ziv implementation of the dictionary based LZ77 transform that", true);
203+
log.println(" removes redundancy in the data.\n", true);
204+
log.println(" LZX: Lempel Ziv Extra. Same as above with a bigger hash table and more", true);
205+
log.println(" match searches.\n", true);
206+
log.println(" LZP: Lempel Ziv Prediction can be described as an LZ implementation with only", true);
207+
log.println(" one possible match (no offset is emitted).\n", true);
208+
log.println(" RLT: Run Length Transform is a simple transform that replaces runs of similar", true);
209+
log.println(" symbols with a compact representation.\n", true);
210+
log.println(" ZRLT: Zero Run Length Transform. Similar to RLT but only processes runs of 0.", true);
211+
log.println(" Usually used post BWT.\n", true);
212+
log.println(" MTFT: Move-To-Front Transform is a transform that reduces entropy by assigning", true);
213+
log.println(" shorter symbols to recent data (like a LRU cache). Usually used post BWT.\n", true);
214+
log.println(" RANK: Rank Transform is a transform that that reduces entropy by assigning shorter", true);
215+
log.println(" symbols based on symbol frequency ranks. Usually used post BWT.\n", true);
216+
log.println(" EXE: a transform that reduces the entropy of executable files (X86 & ARM64)", true);
217+
log.println(" by replacing relative jump addresses with absolute ones.\n", true);
218+
log.println(" TEXT: a text transform that uses a dictionary to replace common words with", true);
219+
log.println(" their dictionary index.\n", true);
220+
log.println(" ROLZ: Reduced Offset Lempel Ziv is an implementation of LZ that replaces match offsets", true);
221+
log.println(" with indexes, creating a more compact output with slower decoding speeds.\n", true);
222+
log.println(" ROLZX: Extended ROLZ with more match searches and a more compact encoding.\n", true);
223+
log.println(" SRT: Sorted Rank Transform is a transform that that reduces entropy by assigning", true);
224+
log.println(" shorter symbols based on symbol frequency ranks. Usually used post BWT.\n", true);
225+
log.println(" MM: Multimedia transform is a fast transform that removes redundancy in correlated", true);
226+
log.println(" channels in some multimedia files (EG. wav, pnm).\n", true);
227+
log.println(" UTF: a fast transform replacing UTF-8 codewords with aliases based on frequencies.\n", true);
228+
log.println(" PACK: a fast transform replacing unused symbols with aliases based on frequencies.\n", true);
229+
log.println(" DNA: same as PACK but triggered only when DNA data is detected.\n", true);
230+
log.println("", true);
231+
log.println("Entropy codecs\n", true);
232+
log.println(" Huffman: a fast implementation of canonical Huffman. Both encoder and decoder", true);
233+
log.println(" use code tables and multi-streams to improve performance.\n", true);
234+
log.println(" RANGE: a fast implementation of a static range codec.\n", true);
235+
log.println(" ANS: based on Range Asymmetric Numeral Systems by Jarek Duda (specifically", true);
236+
log.println(" an implementation by Fabian Giesen). Works in a similar fashion to the Range", true);
237+
log.println(" codec but uses only 1 state instead of 2, and encodes in reverse byte order.\n", true);
238+
log.println(" FPAQ: a binary arithmetic codec based on FPAQ1 by Matt Mahoney. Uses a simple", true);
239+
log.println(" adaptive order 0 predictor based on frequencies.\n", true);
240+
log.println(" CM: a binary arithmetic codec derived from BCM by Ilya Muravyov. Uses context", true);
241+
log.println(" mixing of counters to generate a prediction of the next bit value.\n", true);
242+
log.println(" TPAQ: a binary arithmetic codec based initially on Tangelo 2.4 (itself derived", true);
243+
log.println(" from FPAQ8). Uses context mixing of predictions produced by one layer", true);
244+
log.println(" neural networks. The initial code has been heavily tuned to improve", true);
245+
log.println(" compression ratio and speed. Slow but usually excellent compression ratio.\n", true);
246+
log.println(" TPAQX: Extended TPAQ with more predictions and more memory usage. Slowest but", true);
247+
log.println(" usually the best compression ratio.\n", true);
248+
log.println("", true);
249+
log.println("Examples\n", true);
250+
log.println(" kanzi -c -i foo.txt -o none -b 4m -l 4 -v 3\n", true);
251+
log.println(" kanzi -c -i foo.txt -f -t BWT+MTFT+ZRLT -b 4m -e FPAQ -j 4\n", true);
252+
log.println(" kanzi --compress --input=foo.txt --output=foo.knz --force", true);
253+
log.println(" --transform=BWT+MTFT+ZRLT --block=4m --entropy=FPAQ --jobs=4\n", true);
189254
}
255+
256+
log.println("", true);
257+
log.println("Credits\n", true);
258+
log.println(" Matt Mahoney, Yann Collet, Jan Ondrus, Yuta Mori, Ilya Muravyov,", true);
259+
log.println(" Neal Burns, Fabian Giesen, Jarek Duda, Ilya Grebnov\n", true);
190260
}
191261

192262
void printHeader(Printer& log, int verbose, bool& showHeader)
@@ -558,7 +628,8 @@ int processCommandLine(int argc, const char* argv[], Context& map, Printer& log)
558628
if (outputName != "") {
559629
string msg = (ctx == ARG_IDX_OUTPUT) ? CMD_LINE_ARGS[ctx] : arg;
560630
WARNING_OPT_DUPLICATE(msg, arg);
561-
} else {
631+
}
632+
else {
562633
if ((arg.length() >= 2) && (arg[0] == '.') && (arg[1] == PATH_SEPARATOR)) {
563634
arg = (arg.length() == 2) ? arg.substr(0, 1) : arg.substr(2);
564635
}
@@ -577,7 +648,8 @@ int processCommandLine(int argc, const char* argv[], Context& map, Printer& log)
577648
if (inputName != "") {
578649
string msg = (ctx == ARG_IDX_INPUT) ? CMD_LINE_ARGS[ctx] : arg;
579650
WARNING_OPT_DUPLICATE(msg, arg);
580-
} else {
651+
}
652+
else {
581653
if ((arg.length() >= 2) && (arg[0] == '.') && (arg[1] == PATH_SEPARATOR)) {
582654
arg = (arg.length() == 2) ? arg.substr(0, 1) : arg.substr(2);
583655
}

0 commit comments

Comments
 (0)