Update touch completions for all the platforms

- Generally better descriptions,
- uname checks to not complerte unavailable options on
  NetBSD, FreeBSD, DragonFly, Solaris, Darwin
- Describe/complete GNU's --time=access,mtime... arg
- Remove -f it is a no-op and not documented.
This commit is contained in:
Aaron Gyes 2022-07-09 13:42:00 -07:00
parent 9e43e74723
commit a1dd93df41

View File

@ -1,22 +1,34 @@
complete touch -d "change file access and modification times"
# common options
complete touch -s a -d "change access time (atime)"
complete touch -s m -d "change modification time (mtime)"
complete touch -s t -d "use specified time [[CC]YY]MMDDhhmm[.SS]"
if touch --version 2>/dev/null >/dev/null # GNU if touch --version 2>/dev/null >/dev/null # GNU
complete -c touch -s a -d "Change access time" complete touch -s B -l backward -x -d "set date back"
complete -c touch -s B -l backward -x -d "Set date back" complete touch -s c -l no-create -d "don't create file if it doesn't exist"
complete -c touch -s c -l no-create -d "Do not create file" complete touch -s d -l date -x -d "set to specified YYYY-MM-DDThh:mm:SS[.frac][tz]"
complete -c touch -s d -l date -x -d "Set date" complete touch -s f -l forward -x -d "set date forward"
complete -c touch -s f -l forward -x -d "Set date forward" complete touch -s r -l reference -d "use times from specified reference file"
complete -c touch -s m -d "Change modification time" # TODO these may require that = but builtin complete doesn't seem to infer it should
complete -c touch -s r -l reference -d "Use this files times" # use = here
complete -c touch -s t -d "Set date" complete touch -l time -x -d "change specified kind of timestamp" -a \
complete -c touch -l time -x -d "Set time" "atime\t'change access time (atime) only'
complete -c touch -l help -d "Display help and exit" access\t'change access time (atime) only'
complete -c touch -l version -d "Display version and exit" use\t'change access time (atime) only'
else # OS X mtime\t'change modification time (mtime) only'
complete -c touch -s A -d "Adjust access and modification time stamps by specified VALUE" -r modify\t'change modification time (mtime) only'"
complete -c touch -s a -d "Change access time of file" complete touch -l help -d "display help"
complete -c touch -s c -d "Don't create file if it doesn't exist" complete touch -l version -d "display version"
complete -c touch -s f -d "Attempt to force the update, even when permission don't permit" else # not GNU
complete -c touch -s h -d "Change times of the symlink ranther than the file. Implies `-c'" set -l uname (uname -s)
complete -c touch -s m -d "Change modification time of file" contains $uname Darwin DragonFly FreeBSD
complete -c touch -s r -d "Use access and modifications times from specified file rather than current time of day" and complete touch -s A -d "adjust timestamps by relative value [-][hh]mm]SS" -x
complete -c touch -s t -d "Change access and modifications times to specified file rather than current time of day" contains $uname Darwin DragonFly FreeBSD NetBSD
and complete touch -s h -d "act on symbolic links themselves"
contains $uname Darwin DragonFly FreeBSD OpenBSD SunOS
and complete touch -s d -d "set to specified YYYY-MM-DDThh:mm:SS[.frac][tz]" -x
# common BSD options
complete touch -s c -d "don't create file if it doesn't exist"
complete touch -s r -d "use times from specified reference file" -r
end end