mirror of
https://github.com/zplug/zplug
synced 2025-04-05 23:29:10 +02:00
67 lines
1.4 KiB
Bash
67 lines
1.4 KiB
Bash
#!/usr/bin/env zsh
|
|
# Description:
|
|
# Show the information such as the source URL and tag values for the given package
|
|
|
|
local arg="$1" repo key
|
|
local -a repos
|
|
local -A tags
|
|
|
|
while (( $# > 0 ))
|
|
do
|
|
arg="$1"
|
|
case "$arg" in
|
|
-*|--*)
|
|
__zplug::core::options::unknown "$arg"
|
|
return $status
|
|
;;
|
|
"")
|
|
# Invalid
|
|
return 1
|
|
;;
|
|
*/*)
|
|
repos+=( "${arg:gs:@::}" )
|
|
;;
|
|
*)
|
|
__zplug::io::print::f \
|
|
--die \
|
|
--zplug \
|
|
--error \
|
|
"$arg: invalid argument\n"
|
|
return 1
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
# If no argument is given
|
|
if (( $#repos == 0 )); then
|
|
__zplug::io::print::put \
|
|
"%d plugs, %s\n" \
|
|
$#zplugs \
|
|
"$(du -ch "$ZPLUG_REPOS" | awk '$2 == "total"{print $1}')"
|
|
return 1
|
|
fi
|
|
|
|
for repo in "${repos[@]}"
|
|
do
|
|
if ! __zplug::base::base::zpluged "$repo"; then
|
|
__zplug::io::print::f \
|
|
--die \
|
|
--zplug \
|
|
--func \
|
|
"$repo: no such package\n"
|
|
return 1
|
|
fi
|
|
|
|
__zplug::core::tags::parse "$repo"
|
|
tags=( "${reply[@]}" )
|
|
|
|
for key in "${(k)tags[@]}"
|
|
do
|
|
__zplug::io::print::put \
|
|
"$fg[red]-$reset_color $fg[blue]$key$reset_color: "
|
|
__zplug::io::print::put \
|
|
"$fg[yellow]${(qqq)tags[$key]}$reset_color\n"
|
|
done
|
|
done
|