zsh-workers
 help / color / mirror / code / Atom feed
e08ca56df86fc6b6c657841be5db37a19c0ab22a blob 1028 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 
#autoload

# This function completes 'ls' to '/bin/ls'
_hashed_absolute_command_paths() {
  local -aU set_of_dirs_of_hashed_commands=( ${^commands%/*}/ )
  local i
  integer ret=1
  for i in $set_of_dirs_of_hashed_commands
  do
    local -a matches=( "${(@)commands[(R)${~i}[^/]#]}" )
    local -a descs=( $matches:t )
    compadd -M "l:|=$i" -d descs "$expl[@]" -a matches
    ret=0
  done
  return ret
}

# This function completes absolute pathnames of executables, e.g., /etc/rc.local
_typed-in_absolute_command_paths() {
  # TODO: the description "full path to an executable" and tag in the caller are ignored by _path_files
  if [[ -z $PREFIX ]]; then
    _path_files -/ -g '*(-*)' -P / -W /
  elif [[ $PREFIX[1] == / ]]; then
    _path_files -/ -g '*(-*)' -W /
  else
    return 1
  fi
}

_absolute_command_paths() {
  _alternative \
    'commands:hashed command by absolute path:_hashed_absolute_command_paths' \
    'commands:full path to an executable:_typed-in_absolute_command_paths'
}


_absolute_command_paths "$@"
debug log:

solving e08ca56df ...
found e08ca56df in https://git.vuxu.org/mirror/zsh/

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).