| 1 | cmd Main("gzip") { |
| 2 | /// files to compress or decompress; if omitted, reads from stdin |
| 3 | /// and writes to stdout |
| 4 | arg Files(..) => List<Path> [ |
| 5 | requires FileExists |
| 6 | ] |
| 7 | |
| 8 | /// decompress the given files instead of compressing them |
| 9 | opt Decompress("d", "decompress", "uncompress") => Bool [ |
| 10 | excludes List |
| 11 | excludes Test |
| 12 | ] |
| 13 | |
| 14 | /// list metadata about each compressed file (compressed size, |
| 15 | /// uncompressed size, ratio, original name) without decompressing |
| 16 | opt List("l", "list") => Bool [ |
| 17 | excludes Decompress |
| 18 | excludes Test |
| 19 | excludes Stdout |
| 20 | ] |
| 21 | |
| 22 | /// test the integrity of each compressed file without writing output |
| 23 | opt Test("t", "test") => Bool [ |
| 24 | excludes Decompress |
| 25 | excludes List |
| 26 | excludes Stdout |
| 27 | ] |
| 28 | |
| 29 | /// write output to standard output and keep original files unchanged; |
| 30 | /// if combined with -d and the input is not a recognised format, |
| 31 | /// passes data through unchanged (zcat behaviour) |
| 32 | opt Stdout("c", "stdout", "to-stdout") => Bool |
| 33 | |
| 34 | /// keep (do not delete) input files after compression or decompression |
| 35 | opt Keep("k", "keep") => Bool [] |
| 36 | |
| 37 | type CompressionLevel => 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 38 | |
| 39 | /// compression level: 1 is fastest / least compression, |
| 40 | /// 9 is slowest / best compression; default is 6 |
| 41 | opt Level("1","2","3","4","5","6","7","8","9") => CompressionLevel [ |
| 42 | @default(6) |
| 43 | excludes Fast |
| 44 | excludes Best |
| 45 | ] |
| 46 | |
| 47 | /// alias for -1 (fastest compression) |
| 48 | opt Fast("fast") => Bool [ |
| 49 | excludes Level |
| 50 | excludes Best |
| 51 | ] |
| 52 | |
| 53 | /// alias for -9 (best compression) |
| 54 | opt Best("best") => Bool [ |
| 55 | excludes Level |
| 56 | excludes Fast |
| 57 | ] |
| 58 | |
| 59 | /// when compressing, do not save the original filename or timestamp |
| 60 | /// into the .gz header; when decompressing, ignore them if present |
| 61 | /// (this is the default when decompressing) |
| 62 | opt NoName("n", "no-name") => Bool [ |
| 63 | excludes Name |
| 64 | ] |
| 65 | |
| 66 | /// when compressing, always save the original filename and timestamp |
| 67 | /// into the .gz header (this is the default when compressing); |
| 68 | /// when decompressing, restore both from the header if present |
| 69 | opt Name("N", "name") => Bool [ |
| 70 | excludes NoName |
| 71 | ] |
| 72 | |
| 73 | /// force compression/decompression even if the output file already |
| 74 | /// exists, the file has multiple hard links, or the data is being |
| 75 | /// read from / written to a terminal; when combined with -c and |
| 76 | /// unrecognised input, passes data through unchanged |
| 77 | opt Force("f", "force") => Bool |
| 78 | |
| 79 | /// use SUF as the compressed-file suffix instead of .gz; a null |
| 80 | /// suffix ("") causes gunzip to attempt decompression of all |
| 81 | /// named files regardless of suffix |
| 82 | opt Suffix("S", "suffix") => String [ |
| 83 | @default(".gz") |
| 84 | ] |
| 85 | |
| 86 | /// recursively compress (or decompress) all files inside named |
| 87 | /// directories rather than treating directory arguments as errors |
| 88 | opt Recursive("r", "recursive") => Bool |
| 89 | |
| 90 | /// periodically reset the compressed data stream's internal state |
| 91 | /// so that rsync can efficiently synchronise the output file |
| 92 | opt Rsyncable("rsyncable") => Bool |
| 93 | |
| 94 | /// flush compressed blocks to disk synchronously; safer in the |
| 95 | /// event of a system crash but significantly slower |
| 96 | opt Synchronous("synchronous") => Bool |
| 97 | |
| 98 | /// suppress all warnings and error messages |
| 99 | opt Quiet("q", "quiet") => Bool |
| 100 | |
| 101 | /// display name and compression percentage for each file processed; |
| 102 | /// when combined with --list, also shows method, CRC, and timestamp |
| 103 | opt Verbose("v", "verbose") => Bool |
| 104 | |
| 105 | /// display help and exit |
| 106 | opt Help("h", "help") => Bool [ |
| 107 | excludes All |
| 108 | ] |
| 109 | |
| 110 | /// display the software license and exit |
| 111 | opt License("L", "license") => Bool [ |
| 112 | excludes All |
| 113 | ] |
| 114 | |
| 115 | /// display version number and compilation options, then exit |
| 116 | opt Version("V", "version") => Bool [ |
| 117 | excludes All |
| 118 | ] |
| 119 | } |