2015-08-26 15:20:13 +00:00
|
|
|
# SYNOPSIS
|
2015-09-26 23:15:18 +00:00
|
|
|
# autoload <path>...
|
2015-08-26 15:20:13 +00:00
|
|
|
#
|
|
|
|
# OVERVIEW
|
|
|
|
# Autoload a function or completion path. Add the specified list of
|
|
|
|
# directories to $fish_function_path. Any `completions` directories
|
|
|
|
# are correctly added to the $fish_complete_path.
|
2015-09-26 23:15:18 +00:00
|
|
|
#
|
|
|
|
# Returns 0 if one of the paths exist.
|
|
|
|
# Returns != 0 if all paths are missing.
|
2015-08-26 15:20:13 +00:00
|
|
|
|
|
|
|
function autoload -d "autoload a function or completion path"
|
|
|
|
for path in $argv
|
2015-09-26 23:15:18 +00:00
|
|
|
set -l dest fish_function_path
|
|
|
|
|
2015-08-26 15:20:13 +00:00
|
|
|
if test -d "$path"
|
2015-09-26 23:15:18 +00:00
|
|
|
set path_exist
|
2015-09-04 17:24:25 +00:00
|
|
|
|
|
|
|
if test (basename "$path") = completions
|
2015-08-26 15:20:13 +00:00
|
|
|
set dest fish_complete_path
|
|
|
|
end
|
2015-09-04 17:24:25 +00:00
|
|
|
|
2015-08-26 15:20:13 +00:00
|
|
|
contains "$path" $$dest; or set $dest "$path" $$dest
|
|
|
|
end
|
|
|
|
end
|
2015-09-26 23:15:18 +00:00
|
|
|
|
|
|
|
set -q path_exist
|
2015-08-26 15:20:13 +00:00
|
|
|
end
|