fisher/functions/__fisher_cache.fish
Jorge Bucaran ee0338d5b0
Ahoy! Fisherman gets a super patch v0.3.1
This patch contains several amends for 0.3.0 and
other minor documentation corrections.  Major
documentation revision and rewrite.

fisher help shows fisher(1) by default now.

Fix a critical bug that was causing fisher uninstall
--force to remove not the symbolic link, but the
actual files. Closes #24

Rename orphan tag to custom for plugins installed
using a custom URL.

warning Remove fisher --link flag and create symbolic
links by default for local paths. The user does not
have to worry about symbolic links or whether the
copy is as symbolic link or not anymore. If the user
tries to install a local path, then the best thing
to do is to create a symbolic link. This also
eliminates the need to call update.

warning Remove fisher --cache and fisher --validate.
Now, that these options are separated into their own
function and they are intentionally private, there
is no need for them.
2016-01-10 16:13:46 +09:00

42 lines
1.1 KiB
Fish

function __fisher_cache -a error -d "Get plugin in cache from a name, url or path"
if test -z "$error"
set error /dev/stderr
end
while read --prompt="" -l item
switch "$item"
case file:///\*
for file in $fisher_cache/*
switch "$item"
case file://(readlink $file)
printf "%s\n" $file
break
end
end
case \*/\*
for file in $fisher_cache/*
switch "$item"
case (git -C $file ls-remote --get-url | __fisher_validate)
printf "%s\n" $file
break
end
end
case \*
set item $fisher_cache/$item
if test -d "$item"
printf "%s\n" $item
end
end | read -l path
if test -z "$path"
printf "fisher: Avast! '%s' is not in the cache\n" $item > $error
continue
end
printf "%s\n" $path
end
end