better-emerge-completion.dpatch

- You don't need to supply the package right after -C or -u etc.
- Better descriptions

darcs-hash:20061109145341-a923b-a1a54d3a5a040396ccba350c125f3b1ba645c601.gz
This commit is contained in:
tassilo 2006-11-10 00:53:41 +10:00
parent 9bc9e1c08d
commit 79de45eed5

View file

@ -4,36 +4,46 @@
function __fish_emerge_print_installed_pkgs -d (N_ 'Prints completions for installed packages on the system from /var/db/pkg')
if test -d /var/db/pkg
find /var/db/pkg/ -type d | cut -d'/' -f5-6 | sort | uniq | sed 's/-[0-9]\{1,\}\..*$//'
find /var/db/pkg/ -type d | cut -d'/' -f5-6 | sort | uniq | sed 's/-[0-9]\{1,\}\..*$//' | sed -e '/^ *$/d'
return
end
end
function __fish_emerge_print_all_pkgs -d (N_ 'Prints completions for all available packages on the system from /usr/portage')
if test -d /usr/portage
find /usr/portage/ -maxdepth 2 -type d | cut -d'/' -f4-5 | sed 's/^\(distfiles\|profiles\|eclass\).*$//' | sort | uniq | sed 's/-[0-9]\{1,\}\..*$//'
find /usr/portage/ -maxdepth 2 -type d | cut -d'/' -f4-5 | sed 's/^\(distfiles\|profiles\|eclass\).*$//' | sort | uniq | sed 's/-[0-9]\{1,\}\..*$//' | sed -e '/^ *$/d'
return
end
end
function __fish_emerge_use_installed_package -d (N_ 'Tests if emerge command should have an installed package as potential completion')
for i in (commandline -opc)
if contains -- $i -u --update -C --unmerge -P --prune --config
return 0
end
end
return 1
end
#########################
# Actions
complete -c emerge -xua "(__fish_emerge_print_all_pkgs)"
complete -c emerge -n '__fish_emerge_use_installed_package' -xua 'system\t"'(_ "All base system packages")'" world\t"'(_ "All packages in world")'" (__fish_emerge_print_installed_pkgs)\t"'(_ "Installed package")'"'
complete -c emerge -n 'not __fish_emerge_use_installed_package' -xua 'system\t"'(_ "All base system packages")'" world\t"'(_ "All packages in world")'" (__fish_emerge_print_all_pkgs)\t"'(_ "Package")'"'
complete -c emerge -l sync -d "Synchronize the portage tree"
complete -c emerge -l info -d "Get informations to include in bug reports"
complete -c emerge -s V -l version -d "Displays the version number of emerge"
complete -c emerge -s h -l help -xa '""\t"'(_ "Usage overview of emerge")'" system\t"'(_ "Help on subject system")'" config\t"'(_ "Help on subject config")'" sync\t"'(_ "Help on subject sync")'"' -d "Displays help information for emerge"
complete -c emerge -s c -l clean -d "Remove packages that will not affect the functionality of the system"
complete -c emerge -l config -xa "(__fish_emerge_print_installed_pkgs)" -d "Run package specific actions needed to be executed after the emerge process"
complete -c emerge -l config -d "Run package specific actions needed to be executed after the emerge process"
complete -c emerge -l depclean -d "WARNING: Delete all packages that are neither deps nor in world"
complete -c emerge -l metadata -d "Process all meta-cache files"
complete -c emerge -s P -l prune -xa "(__fish_emerge_print_installed_pkgs)" -d "WARNING: Remove all but the latest version of package"
complete -c emerge -s P -l prune -d "WARNING: Remove all but the latest version of package"
complete -c emerge -l regen -d "Check and update the dependency cache"
complete -c emerge -l resume -d "Resume the last merge operation"
complete -c emerge -s s -l search -d "Search for matches in the portage tree"
complete -c emerge -s S -l searchdesc -d "Search for matches in package names and descriptions"
complete -c emerge -s C -l unmerge -xa "(__fish_emerge_print_installed_pkgs)" -d "WARNING: Remove the given package"
complete -c emerge -s u -l update -xa "(__fish_emerge_print_installed_pkgs)" -d "Update the given package"
complete -c emerge -s C -l unmerge -d "WARNING: Remove the given package"
complete -c emerge -s u -l update -d "Update the given package"
# END Actions
#########################