mirror of
https://github.com/jorgebucaran/fisher
synced 2024-10-09 09:36:53 +02:00
Teach ls to handle multiple arguments. Close #243.
This commit is contained in:
parent
5133e180bb
commit
986ea3741e
1 changed files with 51 additions and 38 deletions
89
fisher.fish
89
fisher.fish
|
@ -1070,53 +1070,66 @@ function __fisher_list
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function __fisher_list_plugin_directory -a item
|
function __fisher_list_plugin_directory
|
||||||
set -l fd $__fisher_stderr
|
if test -z "$argv"
|
||||||
|
|
||||||
set -e argv[1]
|
|
||||||
set -l path "$fisher_config/$item"
|
|
||||||
|
|
||||||
if test ! -d "$path"
|
|
||||||
__fisher_log error "$item is not installed" $__fisher_stderr
|
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
pushd "$path"
|
for item in $argv
|
||||||
|
if test ! -d "$fisher_config/$item"
|
||||||
|
__fisher_log error "@$item@ is not installed" $__fisher_stderr
|
||||||
|
|
||||||
set -l color (set_color $fish_color_command)
|
return 1
|
||||||
set -l nc (set_color normal)
|
end
|
||||||
set -l previous_tree
|
|
||||||
|
|
||||||
if contains -- --no-color $argv
|
|
||||||
set color
|
|
||||||
set nc
|
|
||||||
set fd $__fisher_stdout
|
|
||||||
end
|
end
|
||||||
|
|
||||||
printf "$color%s$nc\n" "$PWD" > $fd
|
set -l fd $__fisher_stderr
|
||||||
|
set -l uniq_items
|
||||||
|
|
||||||
for file in .* **
|
for item in $argv
|
||||||
if test -f "$file"
|
if contains -- "$item" $uniq_items
|
||||||
switch "$file"
|
continue
|
||||||
case \*/\*
|
|
||||||
set -l current_tree (dirname $file)
|
|
||||||
|
|
||||||
if test "$previous_tree" != "$current_tree"
|
|
||||||
printf " $color%s/$nc\n" $current_tree
|
|
||||||
end
|
|
||||||
|
|
||||||
printf " %s\n" (basename $file)
|
|
||||||
|
|
||||||
set previous_tree $current_tree
|
|
||||||
|
|
||||||
case \*
|
|
||||||
printf " %s\n" $file
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end > $fd
|
|
||||||
|
|
||||||
popd
|
set uniq_items $uniq_items "$item"
|
||||||
|
set -l path "$fisher_config/$item"
|
||||||
|
|
||||||
|
pushd "$path"
|
||||||
|
|
||||||
|
set -l color (set_color $fish_color_command)
|
||||||
|
set -l nc (set_color normal)
|
||||||
|
set -l previous_tree
|
||||||
|
|
||||||
|
if contains -- --no-color $argv
|
||||||
|
set color
|
||||||
|
set nc
|
||||||
|
set fd $__fisher_stdout
|
||||||
|
end
|
||||||
|
|
||||||
|
printf "$color%s$nc\n" "$PWD" > $fd
|
||||||
|
|
||||||
|
for file in .* **
|
||||||
|
if test -f "$file"
|
||||||
|
switch "$file"
|
||||||
|
case \*/\*
|
||||||
|
set -l current_tree (dirname $file)
|
||||||
|
|
||||||
|
if test "$previous_tree" != "$current_tree"
|
||||||
|
printf " $color%s/$nc\n" $current_tree
|
||||||
|
end
|
||||||
|
|
||||||
|
printf " %s\n" (basename $file)
|
||||||
|
|
||||||
|
set previous_tree $current_tree
|
||||||
|
|
||||||
|
case \*
|
||||||
|
printf " %s\n" $file
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end > $fd
|
||||||
|
|
||||||
|
popd
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue