| 1 | |
| 2 | cmd Main("head") [ |
| 3 | requires InputFiles |
| 4 | ] { |
| 5 | |
| 6 | // Print the first 10 lines of each FILE to standard output. With more than one FILE, |
| 7 | // precede each with a header giving the file name. |
| 8 | arg InputFiles(..) => List<File> [ |
| 9 | requires FileExists |
| 10 | effects StdOut |
| 11 | ] |
| 12 | |
| 13 | // NUM may have a multiplier suffix: b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024, |
| 14 | // GB 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y, R, Q. Binary prefixes |
| 15 | // can be used, too: KiB=K, MiB=M, and so on. |
| 16 | type SuffixKind => "b" | "kB" | "K" | "MB" | "M" | "GB" | "G" | "T" | "P" | "E" | "Z" | "Y" | "R" | "Q" |
| 17 | |
| 18 | // print the first NUM bytes of each file; with the leading '-', print all but the last NUM |
| 19 | // bytes of each file |
| 20 | opt Bytes("c", "bytes") => String |
| 21 | |
| 22 | // print the first NUM lines instead of the first 10; with the leading '-', print all but the last NUM lines |
| 23 | // of each file |
| 24 | opt Lines("n", "lines") => String |
| 25 | |
| 26 | // never print headers giving file names |
| 27 | opt Quiet("q", "quiet", "silent") => Bool |
| 28 | |
| 29 | // always print headers giving file names |
| 30 | opt Verbose("v", "verbose") => Bool |
| 31 | |
| 32 | // line delimiter is NUL, not newline |
| 33 | opt Verbose("z", "zero-terminated") => Bool |
| 34 | |
| 35 | // display this help and exit |
| 36 | opt Verbose("help") => Bool |
| 37 | |
| 38 | // output version information and exit |
| 39 | opt Verbose("version") => Bool |
| 40 | } |