summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-07-07 11:03:46 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2009-07-07 11:03:46 +0200
commitada1cdfdf960047892bb9632e2c81581991acef6 (patch)
treec601f0e59bdcaff4dd93c009ff39662c9aa8be70
parentc987638443ed2e58e464bf0574a63639e521a95d (diff)
pkg: Added short actions (pkg a = add etc)
-rwxr-xr-xbin/pkg22
-rw-r--r--man/1/pkg16
-rw-r--r--provides/zsh/completions/_pkg14
3 files changed, 34 insertions, 18 deletions
diff --git a/bin/pkg b/bin/pkg
index e174861..28b1af5 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -824,36 +824,36 @@ cd $PKG_DIR || die "Cannot cd $PKG_DIR"
# Note:
# wrap foobar "$1" <- the "" are neccessary here, since $1 is optional (and therefore may be empty)
case $action in
- add|install)
+ a|add|install)
if [[ $action == install ]] {
warn "pkg install is deprecated, use pkg add instead\n"
}
pkg_add $*
;;
- delete|remove)
+ rm|delete|remove)
if [[ $action == delete ]] {
warn "pkg delete is deprecated, use pkg remove instead\n"
}
pkg_remove $*
;;
- info) pkg_info $* ;;
- list) pkg_list $* ;;
- log) pkg_log $* ;;
- push)
+ i|info) pkg_info $* ;;
+ ls|list) pkg_list $* ;;
+ l|log) pkg_log $* ;;
+ p|push)
(( AUTOUPDATE )) && pkg_update
wrap pkg_push "$1" 'Pushing'
;;
- refresh) wrap pkg_refresh "$1" 'Refreshing' ;;
- status) wrap pkg_status "$1" 'Checking package status' ;;
- update) pkg_update $* ;;
- upgrade|pull)
+ r|refresh) wrap pkg_refresh "$1" 'Refreshing' ;;
+ s|status) wrap pkg_status "$1" 'Checking package status' ;;
+ u|update) pkg_update $* ;;
+ f|upgrade|pull)
if [[ $action == upgrade ]] {
warn "pkg updgrade is deprecated, use pkg pull instead\n"
}
(( AUTOUPDATE )) && pkg_update remote
wrap pkg_upgrade "$1" 'Looking for updates'
;;
- eval) eval $* ;;
+ e|eval) eval $* ;;
*) die "wait, what?\npkg: unknown action: '$action'\n" ;;
esac
diff --git a/man/1/pkg b/man/1/pkg
index 3b5c689..ac88ca6 100644
--- a/man/1/pkg
+++ b/man/1/pkg
@@ -82,6 +82,22 @@ If no argument is given, updates all installed packages
=back
+=head2 SHORT ACTIONS
+
+ short long form
+ ----- ---------
+ a add
+ e eval
+ f pull (think "fetch")
+ i info
+ l log
+ ls list
+ p push
+ r refresh
+ rm remove
+ s status
+ u update
+
=head1 OPTIONS
Options marked as [boolean] may be negated
diff --git a/provides/zsh/completions/_pkg b/provides/zsh/completions/_pkg
index 33992fd..36f0081 100644
--- a/provides/zsh/completions/_pkg
+++ b/provides/zsh/completions/_pkg
@@ -31,26 +31,26 @@ function _pkg_notinstalled () {
function _pkg_args {
if (( CURRENT == 2 )) {
case ${words[1]} in
- log|pull|push|refresh|remove|status)
+ l|log|f|pull|p|push|r|refresh|rm|remove|s|status)
_pkg_installed
;;
- info)
+ i|info)
_pkg_all
;;
- add)
+ a|add)
_pkg_notinstalled
;;
- eval)
+ e|eval)
_message 'shell code for evaluation'
_wanted function expl 'internal function' \
compadd $(grep -E '^\S*\s*\(\)\s*{' =pkg | cut -d ' ' -f 1) \
$(grep -E 'function \S* (\(\) )?{' =pkg | cut -d ' ' -f 2)
;;
- list)
+ ls|list)
_wanted something expl 'list mode' \
compadd all local not-installed
;;
- update)
+ u|update)
_wanted mode expl 'update target' \
compadd local remote
;;
@@ -58,7 +58,7 @@ function _pkg_args {
_message 'no more arguments'
;;
esac
- } elif [[ ${words[1]} = 'eval' ]] {
+ } elif [[ ${words[1]} == e(val|) ]] {
_message 'shell code for evaluation'
if (( CURRENT == 3 )) {
case ${words[2]} in