summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/pkg19
-rw-r--r--man/1/pkg21
-rw-r--r--provides/zsh/completions/_pkg12
3 files changed, 38 insertions, 14 deletions
diff --git a/bin/pkg b/bin/pkg
index 965af60..55f493d 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -706,8 +706,20 @@ function pkg_upgrade {
fi
}
-function pkg_list_installed {
- cut -d ' ' -f 1 $PDIR/.list
+function pkg_list {
+ case $1 in
+ ''|local)
+ cut -d ' ' -f 1 $PDIR/.list
+ ;;
+ all|remote)
+ cut -d ' ' -f 1 $PDIR/.list-remote
+ ;;
+ not-installed)
+ while read package crap; do
+ grep "^$package" $PDIR/.list &> /dev/null || echo $package
+ done < $PDIR/.list-remote
+ ;;
+ esac
}
function pkg_list_available {
@@ -833,8 +845,7 @@ case $action in
delete) pkg_remove $* ;;
info) pkg_info $* ;;
install) pkg_add $* ;;
- list) pkg_list_installed $* ;;
- list-all) pkg_list_available $* ;;
+ list) pkg_list $* ;;
local-update) pkg_update_local $* ;;
log) pkg_log $* ;;
push)
diff --git a/man/1/pkg b/man/1/pkg
index 1cf823c..56e8dae 100644
--- a/man/1/pkg
+++ b/man/1/pkg
@@ -32,16 +32,25 @@ Evauluate I<expression>. See the 'Examples' section and pkg(7)
Show information on I<package>, like dependencies, version, etc
-=item B<list>
+=item B<list> [I<filter>]
-List all installed packages
+List packages depending on I<filter>:
-=item B<list-all>
+=over
+
+=item * B<all>
+
+show all packages
+
+=item * B<local>
-List all available (both installed and not installed packages
+show currently installed packages (default)
-Hint: C<diff <(pkg list) <(pkg list-all)> will show all packages
-that are currently not installed
+=item * B<not-installed>
+
+show remote packages which are not installed
+
+=back
=item B<local-update>
diff --git a/provides/zsh/completions/_pkg b/provides/zsh/completions/_pkg
index b28b1b3..e0d0b00 100644
--- a/provides/zsh/completions/_pkg
+++ b/provides/zsh/completions/_pkg
@@ -9,23 +9,23 @@ typeset expl
function _pkg_action () {
_wanted action expl 'action' \
- compadd add install delete eval remove info list{,-all} \
+ compadd add install delete eval remove info list \
local-update log pull push remote-update refresh status update upgrade
}
function _pkg_installed () {
_wanted package expl 'local package' \
- compadd $(pkg list)
+ compadd $(pkg list local)
}
function _pkg_all () {
_wanted package expl 'package' \
- compadd $(pkg list-all)
+ compadd $(pkg list all)
}
function _pkg_notinstalled () {
_wanted package expl 'remote package' \
- compadd $(diff <(pkg list) <(pkg list-all) | grep "^>" | cut -d " " -f 2)
+ compadd $(pkg list remote)
}
function _pkg_args {
@@ -46,6 +46,10 @@ function _pkg_args {
compadd $(grep -E '^\S*\s*\(\)\s*{' =pkg | cut -d ' ' -f 1) \
$(grep -E 'function \S* (\(\) )?{' =pkg | cut -d ' ' -f 2)
;;
+ list)
+ _wanted something expl 'list mode' \
+ compadd all local remote
+ ;;
*)
_message 'no more arguments'
;;