Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
5f376495
Commit
5f376495
authored
Jun 30, 2012
by
mapc
Browse files
Dynamicly generate completion functions to support changing apt_pref
parent
e3c87611
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/debian/debian.plugin.zsh
View file @
5f376495
...
@@ -110,18 +110,39 @@ fi
...
@@ -110,18 +110,39 @@ fi
# Completion ################################################################
# Completion ################################################################
# TODO: These definitions won't change between apt-get and uptitude automaticaly
#
compdef _apt
aac
=
"
$apt_pref
autoclean"
# Registers a compdef for $1 that calls $apt_pref with the commands $2
compdef _apt
abd
=
"
$apt_pref
build-dep"
# To do that it creates a new completion function called _apt_pref_$2
compdef _apt
ac
=
"
$apt_pref
clean"
#
compdef _apt
ad
=
"
$apt_pref
update"
apt_pref_compdef
()
{
compdef _apt
afu
=
"
$apt_pref
update"
local
f fb
compdef _apt
ag
=
"
$apt_pref
upgrade"
f
=
"_apt_pref_
${
2
}
"
compdef _apt
ai
=
"
$apt_pref
install"
compdef _apt
ail
=
"
$apt_pref
install"
fb
=
"function
${
f
}
() {
compdef _apt
ap
=
"
$apt_pref
purge"
shift words;
compdef _apt
ar
=
"
$apt_pref
remove"
service=
\"\$
apt_pref
\"
;
compdef _apt
ads
=
"apt-get dselect-upgrade"
words=(
\"\$
apt_pref
\"
'
$2
'
\$
words);
((CURRENT++))
test
\"\$
{apt_pref}
\"
= 'aptitude' && _aptitude || _apt
}"
eval
"
$fb
"
echo
"
$fb
"
compdef
"
$f
"
"
$1
"
}
apt_pref_compdef aac
"autoclean"
apt_pref_compdef abd
"build-dep"
apt_pref_compdef ac
"clean"
apt_pref_compdef ad
"update"
apt_pref_compdef afu
"update"
apt_pref_compdef ag
"upgrade"
apt_pref_compdef ai
"install"
apt_pref_compdef ail
"install"
apt_pref_compdef ap
"purge"
apt_pref_compdef ar
"remove"
apt_pref_compdef ads
"dselect-upgrade"
# Misc. #####################################################################
# Misc. #####################################################################
# print all installed packages
# print all installed packages
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment