| 1 | cmd Main("touch") [ |
| 2 | requires Files |
| 3 | ] { |
| 4 | /// files whose timestamps should be updated, or created if they do not exist |
| 5 | arg Files(..) => List<Path> [ |
| 6 | effects FileExists |
| 7 | ] |
| 8 | |
| 9 | /// change only the access time; if absent, both access and modification |
| 10 | /// times are updated |
| 11 | opt AccessOnly("a") => Bool [ |
| 12 | excludes ModifyOnly |
| 13 | ] |
| 14 | |
| 15 | /// do not create any files; silently ignore each argument that does not |
| 16 | /// already exist |
| 17 | opt NoCreate("c", "no-create") => Bool |
| 18 | |
| 19 | /// parse STRING as a date/time description and use it instead of the |
| 20 | /// current time (e.g. "2 hours ago", "next Monday", "2024-06-01 12:00") |
| 21 | opt Date("d", "date") => String [ |
| 22 | excludes Reference & Stamp |
| 23 | ] |
| 24 | |
| 25 | /// affect each symbolic link itself rather than the file the link |
| 26 | /// refers to; only on systems that support lchown(2) |
| 27 | opt NoDereference("h", "no-dereference") => Bool |
| 28 | |
| 29 | /// change only the modification time |
| 30 | opt ModifyOnly("m") => Bool [ |
| 31 | excludes AccessOnly |
| 32 | ] |
| 33 | |
| 34 | /// use the timestamps of FILE instead of the current time; FILE must |
| 35 | /// already exist |
| 36 | opt Reference("r", "reference") => Path [ |
| 37 | requires FileExists |
| 38 | excludes Date & Stamp |
| 39 | ] |
| 40 | |
| 41 | /// use the time STAMP instead of the current time, where STAMP is |
| 42 | /// formatted as [[CC]YY]MMDDhhmm[.ss] |
| 43 | /// TODO add a refinement type: @pattern("^(\\d{2})?(\\d{2})?\\d{4}\\d{4}(\\.\\d{2})?$") |
| 44 | opt Stamp("t") => String [ |
| 45 | excludes Date & Reference |
| 46 | ] |
| 47 | |
| 48 | /// explicitly select which timestamp to update: "access", "atime", and |
| 49 | /// "use" are equivalent to -a; "modify" and "mtime" are equivalent to -m |
| 50 | opt Time("time") => "access" | "atime" | "use" | "modify" | "mtime" |
| 51 | |
| 52 | /// display help and exit |
| 53 | opt Help("help") => Bool [ |
| 54 | excludes All |
| 55 | ] |
| 56 | |
| 57 | /// output version information and exit |
| 58 | opt Version("version") => Bool [ |
| 59 | excludes All |
| 60 | ] |
| 61 | } |