2006-11-08 05:16:17 +08:00
|
|
|
# Completions for emerge
|
2006-01-25 07:32:29 +08:00
|
|
|
|
2006-11-08 05:16:17 +08:00
|
|
|
# Author: Tassilo Horn <tassilo@member.fsf.org>
|
2006-01-25 07:32:29 +08:00
|
|
|
|
2017-10-12 01:17:35 +08:00
|
|
|
function __fish_emerge_print_installed_pkgs -d 'Prints completions for installed packages on the system from /var/db/pkg'
|
2006-11-08 05:16:17 +08:00
|
|
|
if test -d /var/db/pkg
|
2016-12-21 08:25:14 +08:00
|
|
|
find /var/db/pkg/ -type d | cut -d'/' -f5-6 | sort -u | \
|
2014-11-30 11:00:49 +08:00
|
|
|
sed 's/-[0-9]\{1,\}\..*$//' | sed -e '/^ *$/d'
|
2006-11-08 05:16:17 +08:00
|
|
|
return
|
|
|
|
end
|
2006-01-25 07:32:29 +08:00
|
|
|
end
|
|
|
|
|
2017-10-12 01:17:35 +08:00
|
|
|
function __fish_emerge_print_all_pkgs -d 'Prints completions for all available packages on the system from /usr/portage'
|
2006-11-08 05:16:17 +08:00
|
|
|
if test -d /usr/portage
|
2014-11-30 11:00:49 +08:00
|
|
|
find /usr/portage/ -maxdepth 2 -type d | cut -d'/' -f4-5 | \
|
2016-12-21 08:25:14 +08:00
|
|
|
sed 's/^\(distfiles\|profiles\|eclass\).*$//' | sort -u | \
|
2014-11-30 11:00:49 +08:00
|
|
|
sed 's/-[0-9]\{1,\}\..*$//' | sed -e '/^ *$/d'
|
2006-11-08 05:16:17 +08:00
|
|
|
return
|
|
|
|
end
|
2006-01-25 07:32:29 +08:00
|
|
|
end
|
|
|
|
|
2017-10-12 01:17:35 +08:00
|
|
|
function __fish_emerge_use_installed_package -d 'Tests if emerge command should have an installed package as potential completion'
|
2006-11-09 22:53:41 +08:00
|
|
|
for i in (commandline -opc)
|
|
|
|
if contains -- $i -u --update -C --unmerge -P --prune --config
|
|
|
|
return 0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return 1
|
|
|
|
end
|
|
|
|
|
2014-11-30 12:34:42 +08:00
|
|
|
|
2017-10-12 01:17:35 +08:00
|
|
|
function __fish_emerge_print_all_pkgs_with_version_compare -d 'Print completions for all packages including the version compare if that is already typed'
|
2017-04-16 12:29:07 +08:00
|
|
|
set -l version_comparator (commandline -t | string match -r '^[\'"]*[<>]\?=\?' | \
|
2014-11-30 12:34:42 +08:00
|
|
|
sed -r 's/^[\'"]*(.*)/\1/g')
|
|
|
|
set -l sedstring
|
|
|
|
|
|
|
|
if set -q $version_comparator
|
|
|
|
set sedstring 's/^(.*)/\1\tPackage/g'
|
|
|
|
else
|
|
|
|
set sedstring 's/^(.*)/'$version_comparator'\1\tPackage/g'
|
|
|
|
end
|
|
|
|
|
|
|
|
__fish_emerge_print_all_pkgs | sed -r $sedstring
|
|
|
|
end
|
|
|
|
|
2006-11-08 05:16:17 +08:00
|
|
|
#########################
|
|
|
|
# Actions
|
2014-11-30 11:00:49 +08:00
|
|
|
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")'" '\
|
2014-11-30 12:34:42 +08:00
|
|
|
'@world\t"'(_ "All packages in world")'" '\
|
|
|
|
'@preserved-rebuild\t"'(_ 'Packages that are linked to preserved libs')'" '\
|
|
|
|
'@module-rebuild\t"'(_ "Packages that contain kernel modules")'" '\
|
|
|
|
'(__fish_emerge_print_all_pkgs_with_version_compare)'
|
2014-11-30 11:00:49 +08:00
|
|
|
|
2006-11-08 05:16:17 +08:00
|
|
|
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"
|
2014-11-30 11:00:49 +08:00
|
|
|
complete -c emerge -s h -l help -d "Displays help information for emerge" -xa \
|
|
|
|
'""\t"'(_ "Usage overview of emerge")'" '\
|
|
|
|
'system\t"'(_ "Help on subject system")'" '\
|
|
|
|
'config\t"'(_ "Help on subject config")'" '\
|
|
|
|
'sync\t"'(_ "Help on subject sync")'"'
|
|
|
|
|
2006-11-08 05:16:17 +08:00
|
|
|
complete -c emerge -s c -l clean -d "Remove packages that will not affect the functionality of the system"
|
2006-11-09 22:53:41 +08:00
|
|
|
complete -c emerge -l config -d "Run package specific actions needed to be executed after the emerge process"
|
2006-11-08 05:16:17 +08:00
|
|
|
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"
|
2006-11-09 22:53:41 +08:00
|
|
|
complete -c emerge -s P -l prune -d "WARNING: Remove all but the latest version of package"
|
2006-11-08 05:16:17 +08:00
|
|
|
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"
|
2006-11-09 22:53:41 +08:00
|
|
|
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"
|
2006-11-08 05:16:17 +08:00
|
|
|
# END Actions
|
|
|
|
#########################
|
|
|
|
|
|
|
|
#########################
|
|
|
|
# Options
|
|
|
|
complete -c emerge -l alphabetical -d "Sort flag lists alphabetically"
|
|
|
|
complete -c emerge -s a -l ask -d "Prompt the user before peforming the merge"
|
|
|
|
complete -c emerge -s b -l buildpkg -d "Build a binary package additionally"
|
|
|
|
complete -c emerge -s B -l buildpkgonly -d "Only build a binary package"
|
|
|
|
complete -c emerge -s l -l changelog -d "Show changelog of package. Use with --pretend"
|
2014-11-30 11:00:49 +08:00
|
|
|
complete -c emerge -l color -d "Toggle colorized output" -xa \
|
|
|
|
'y\t"'(_ "Use colors in output")'" '\
|
|
|
|
'n\t"'(_ "Don't use colors in output")'"'
|
|
|
|
|
2006-11-08 05:16:17 +08:00
|
|
|
complete -c emerge -l colums -d "Align output. Use with --pretend"
|
|
|
|
complete -c emerge -s d -l debug -d "Run in debug mode"
|
|
|
|
complete -c emerge -s D -l deep -d "Consider the whole dependency tree"
|
|
|
|
complete -c emerge -s e -l emptytree -d "Reinstall all world packages"
|
|
|
|
complete -c emerge -s f -l fetchonly -d "Only download the packages but don't install them"
|
|
|
|
complete -c emerge -s F -l fetch-all-uri -d "Same as --fetchonly and grab all potential files"
|
|
|
|
complete -c emerge -s g -l getbinpkg -d "Download infos from each binary package. Implies -k"
|
|
|
|
complete -c emerge -s G -l getbinpkgonly -d "As -g but don't use local infos"
|
|
|
|
complete -c emerge -l ignore-default-opts -d "Ignore EMERGE_DEFAULT_OPTS"
|
|
|
|
complete -c emerge -s N -l newuse -d "Include installed packages with changed USE flags"
|
|
|
|
complete -c emerge -l noconfmem -d "Disregard merge records"
|
|
|
|
complete -c emerge -s O -l nodeps -d "Don't merge dependencies"
|
|
|
|
complete -c emerge -s n -l noreplace -d "Skip already installed packages"
|
|
|
|
complete -c emerge -l nospinner -d "Disable the spinner"
|
|
|
|
complete -c emerge -s 1 -l oneshot -d "Don't add packages to world"
|
|
|
|
complete -c emerge -s o -l onlydeps -d "Only merge dependencies"
|
|
|
|
complete -c emerge -s p -l pretend -d "Display what would be done without doing it"
|
|
|
|
complete -c emerge -s q -l quit -d "Use a condensed output"
|
|
|
|
complete -c emerge -l skipfirst -d "Remove the first package in the resume list. Use with --resume"
|
|
|
|
complete -c emerge -s t -l tree -d "Show the dependency tree"
|
|
|
|
complete -c emerge -s k -l usepkg -d "Use binary package if available"
|
|
|
|
complete -c emerge -s K -l usepkgonly -d "Only use binary packages"
|
|
|
|
complete -c emerge -s v -l verbose -d "Run in verbose mode"
|
2014-11-30 11:00:49 +08:00
|
|
|
complete -c emerge -l with-bdeps -d "Toggle build time dependencies" -xa \
|
|
|
|
'y\t"'(_ "Pull in build time dependencies")'" '\
|
|
|
|
'n\t"'(_ "Don't pull in build time dependencies")'"'
|
|
|
|
|
2006-11-08 05:16:17 +08:00
|
|
|
# END Options
|
|
|
|
#########################
|
|
|
|
|