mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-09 12:56:41 +10:00
37 lines
1.0 KiB
Bash
Executable File
37 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
if [[ $1 == "pkg" ]] && [[ $2 == "list" ]]; then
|
|
CUR_VER=`readlink $GVM_ROOT/go | awk '{ n=split($1,path,"/"); print path[n] }'`
|
|
CUR_PKGSET=`readlink $GVM_ROOT/pkgs | awk '{ n=split($1,path,"/"); print path[n] }'`
|
|
echo "
|
|
gvm packages $CUR_PKGSET@$CUR_VER"
|
|
echo
|
|
for package in $GVM_ROOT/pkgs/pkg.gvm/*; do
|
|
if [ $package == "$GVM_ROOT/pkgs/pkg.gvm/*" ]; then
|
|
break
|
|
fi
|
|
package_name=`echo $package | awk '{ n=split($1,path,"/"); print path[n] }'`
|
|
output=$package_name" ("
|
|
first=true
|
|
for version in $package/*; do
|
|
version=`echo $version | awk '{ n=split($1,path,"/"); print path[n] }'`
|
|
if [ "$version" != "current" ]; then
|
|
if [ $first == true ]; then
|
|
first=false
|
|
else
|
|
output=$output", "
|
|
fi
|
|
version=`echo $version | awk '{ n=split($1,path,"/"); print path[n] }'`
|
|
output=$output$version
|
|
fi
|
|
done
|
|
output=$output")"
|
|
|
|
echo $output
|
|
done
|
|
echo
|
|
else
|
|
echo "Please use gvm [action] to call this file"
|
|
exit 1
|
|
fi
|
|
|