mirror of
https://github.com/jorgebucaran/fisher
synced 2024-10-09 09:36:53 +02:00
fix: ls should show only user installed packages; close #511
This commit is contained in:
parent
03bfe5ed2a
commit
12661c592f
1 changed files with 25 additions and 13 deletions
36
fisher.fish
36
fisher.fish
|
@ -43,7 +43,7 @@ function fisher -a cmd -d "fish package manager"
|
|||
case copy-user-key-bindings
|
||||
_fisher_copy_user_key_bindings
|
||||
case ls
|
||||
_fisher_ls | _fisher_fmt
|
||||
_fisher_ls | _fisher_fmt | _fisher_filter
|
||||
case self-update
|
||||
_fisher_self_update (status -f)
|
||||
case self-uninstall
|
||||
|
@ -83,13 +83,10 @@ function _fisher_self_complete
|
|||
complete -xc fisher -n __fish_use_subcommand -a help -d "Show usage help"
|
||||
complete -xc fisher -n __fish_use_subcommand -a version -d "$fisher_version"
|
||||
complete -xc fisher -n __fish_use_subcommand -a self-update -d "Update to the latest version"
|
||||
set -l file (_fisher_fmt < $fisher_path/fishfile | _fisher_read)
|
||||
for pkg in (_fisher_ls | _fisher_fmt)
|
||||
if contains -- $pkg $file
|
||||
for pkg in (_fisher_ls | _fisher_fmt | _fisher_filter)
|
||||
complete -xc fisher -n "__fish_seen_subcommand_from rm" -a $pkg
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_copy_user_key_bindings
|
||||
if functions -q fish_user_key_bindings
|
||||
|
@ -106,12 +103,31 @@ function _fisher_copy_user_key_bindings
|
|||
end
|
||||
|
||||
function _fisher_ls
|
||||
set -l pkgs $fisher_config/*/*/*
|
||||
for pkg in $pkgs
|
||||
for pkg in $fisher_config/*/*/*
|
||||
command readlink $pkg; or echo $pkg
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_fmt
|
||||
command sed "s|^[[:space:]]*||;s|^$fisher_config/||;s|^$HOME|~|;s|^\.\/|$PWD/|;s|^github\.com/||;s|^https*://||;s|/*\$||"
|
||||
end
|
||||
|
||||
function _fisher_file -a file
|
||||
set -e argv[1]
|
||||
_fisher_fmt < $file | _fisher_read $argv
|
||||
end
|
||||
|
||||
function _fisher_filter
|
||||
set -l file (_fisher_file $fisher_path/fishfile)
|
||||
command awk -v FILE="$file" '
|
||||
BEGIN {
|
||||
n = split(FILE, file, " ")
|
||||
for (i = 1; i <= n; i++) found[file[i]] = i
|
||||
}
|
||||
found[$0]
|
||||
'
|
||||
end
|
||||
|
||||
function _fisher_version -a file
|
||||
echo "fisher version $fisher_version $file" | command sed "s|$HOME|~|"
|
||||
end
|
||||
|
@ -196,7 +212,7 @@ function _fisher_commit -a cmd
|
|||
command rm -Rf $fisher_config
|
||||
command mkdir -p $fisher_config
|
||||
|
||||
set -l next_pkgs (_fisher_fmt < $fishfile | _fisher_read $cmd (printf "%s\n" $argv | _fisher_fmt))
|
||||
set -l next_pkgs (_fisher_file $fishfile $cmd (printf "%s\n" $argv | _fisher_fmt))
|
||||
set -l new_pkgs (_fisher_fetch $next_pkgs)
|
||||
set -l old_pkgs
|
||||
for pkg in $rm_pkgs
|
||||
|
@ -239,10 +255,6 @@ function _fisher_commit -a cmd
|
|||
' >&2
|
||||
end
|
||||
|
||||
function _fisher_fmt
|
||||
command sed "s|^[[:space:]]*||;s|^$fisher_config/||;s|^$HOME|~|;s|^\.\/|$PWD/|;s|^github\.com/||;s|^https*://||;s|/*\$||"
|
||||
end
|
||||
|
||||
function _fisher_read -a cmd
|
||||
set -e argv[1]
|
||||
command awk -v FS="[[:space:]]*#" -v CMD="$cmd" -v ARGS="$argv" '
|
||||
|
|
Loading…
Reference in a new issue