2018-03-24 02:42:30 +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'
# set -l version_comparator (commandline -t | string match -r '^[\'"]*[<>]\?=\?' | \
# 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
function __fish_emerge_print_sets
2019-05-05 18:53:09 +08:00
for s in '@' ( emerge --list-sets )
switch $s
case @profile
printf '%s\t%s\n' $s 'set of packages deemed necessary for your system to run properly'
case @selected-packages
printf '%s\t%s\n' $s 'packages listed in /var/lib/portage/world'
case @selected-sets
printf '%s\t%s\n' $s 'sets listed in /var/lib/portage/world_sets'
case @selected
printf '%s\t%s\n' $s 'encompasses both the selected-packages and selected-sets sets'
case @system
printf '%s\t%s\n' $s 'set of packages deemed necessary for your system to run properly'
case @world
printf '%s\t%s\n' $s 'encompasses the selected, system and profile sets'
case '*'
echo $s
end
end
2006-01-25 07:32:29 +08:00
end
2018-03-24 02:42:30 +08:00
# TODO <ebuild|tbz2file|file|@set|atom>...
function __fish_emerge_possible_args
2019-05-05 18:53:09 +08:00
if __fish_contains_opt check-news -s h help list-sets metadata regen -s r resume \
-s s search -s S searchdesc sync -s V version
return
# TODO deselect=y
else if __fish_contains_opt config -s c depclean info -s P prune -s C unmerge
__fish_emerge_print_sets
__fish_portage_print_installed_pkgs
# TODO deselect=n
else
__fish_emerge_print_sets
__fish_portage_print_available_pkgs
end
2006-11-09 22:53:41 +08:00
end
2018-03-24 02:42:30 +08:00
complete -c emerge -xa "(__fish_emerge_possible_args)"
2014-11-30 12:34:42 +08:00
2006-11-08 05:16:17 +08:00
#########################
2018-03-24 02:42:30 +08:00
# Actions #
2006-11-08 05:16:17 +08:00
#########################
2019-05-05 18:53:09 +08:00
complete -c emerge -l check-news
complete -c emerge -l clean
complete -c emerge -l config
2018-03-24 02:42:30 +08:00
complete -c emerge -s c -l depclean
2019-05-05 18:53:09 +08:00
complete -c emerge -l deselect
2018-03-24 02:42:30 +08:00
complete -c emerge -s h -l help
2019-05-05 18:53:09 +08:00
complete -c emerge -l info
complete -c emerge -l list-sets
complete -c emerge -l metadata
2018-03-24 02:42:30 +08:00
complete -c emerge -s P -l prune
2019-05-05 18:53:09 +08:00
complete -c emerge -l regen
2018-03-24 02:42:30 +08:00
complete -c emerge -s r -l resume
complete -c emerge -s s -l search
complete -c emerge -s S -l searchdesc
2019-05-05 18:53:09 +08:00
complete -c emerge -l sync
2018-03-24 02:42:30 +08:00
complete -c emerge -s C -l unmerge
complete -c emerge -s V -l version
2006-11-08 05:16:17 +08:00
#########################
2018-03-24 02:42:30 +08:00
# Options #
2006-11-08 05:16:17 +08:00
#########################
2019-05-05 18:53:09 +08:00
complete -c emerge -s A -l alert -d "Add a terminal bell character ('\a') to all interactive prompts"
2018-03-24 02:42:30 +08:00
#complete -c emerge -l alphabetical -d "Sort flag lists alphabetically"
2019-05-05 18:53:09 +08:00
complete -c emerge -s a -l ask -d "Prompt the user before peforming the merge"
2018-03-24 02:42:30 +08:00
# ask-enter-invalid
# autounmask
# autounmask-backtrack <yn>
# autounmask-continue
# autounmask-only
# autounmask-unrestricted-atoms
# autounmask-keep-keywords
# autounmask-keep-masks
# autounmask-write
2019-05-05 18:53:09 +08:00
complete -c emerge -l backtrack
complete -c emerge -s b -l buildpkg -d "Build a binary pkg additionally"
2018-03-24 02:42:30 +08:00
# buildpkg-exclude
complete -c emerge -s B -l buildpkgonly -d "Only build a binary pkg"
# changed-deps
complete -c emerge -s U -l changed-use
2019-05-05 18:53:09 +08:00
complete -c emerge -s l -l changelog -d "Show changelog of pkg. Use with --pretend"
complete -c emerge -l color -d "Colorized output" \
-xa "y n"
complete -c emerge -l columns -d "Align output. Use with --pretend"
complete -c emerge -l complete -graph
2018-03-24 02:42:30 +08:00
# complete-graph-if-new-use <yn>
# complete-graph-if-new-ver <yn>
# config-root DIR
2019-05-05 18:53:09 +08:00
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"
2018-03-24 02:42:30 +08:00
# depclean-lib-check
# digest
# dynamic-deps <yn>
2019-05-05 18:53:09 +08:00
complete -c emerge -s e -l emptytree -d "Reinstall all world pkgs"
2018-03-24 02:42:30 +08:00
# exclude ATOMS
2019-05-05 18:53:09 +08:00
complete -c emerge -l exclude
2018-03-24 02:42:30 +08:00
# fail-clean
2019-05-05 18:53:09 +08:00
complete -c emerge -s f -l fetchonly -d "Only download the pkgs but don't install them"
complete -c emerge -s F -l fetch-all-uri -d "Same as --fetchonly and grab all potential files"
2018-03-24 02:42:30 +08:00
# fuzzy-search
2019-05-05 18:53:09 +08:00
complete -c emerge -s g -l getbinpkg -d "Download infos from each binary pkg. 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"
2018-03-24 02:42:30 +08:00
# ignore-build-slot-operator-deps <yn>
# ignore-soname-deps <yn>
2019-05-05 18:53:09 +08:00
complete -c emerge -l jobs
complete -c emerge -l keep-going
2018-03-24 02:42:30 +08:00
# load-average
# misspell-suggestion
# newrepo
2019-05-05 18:53:09 +08:00
complete -c emerge -s N -l newuse -d "Include installed pkgs 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 pkgs"
complete -c emerge -l nospinner -d "Disable the spinner"
2018-03-24 02:42:30 +08:00
# usepkg-exclude ATOMS
# rebuild-exclude ATOMS
# rebuild-ignore ATOMS
2019-05-05 18:53:09 +08:00
complete -c emerge -s 1 -l oneshot -d "Don't add pkgs to world"
complete -c emerge -s o -l onlydeps -d "Only merge dependencies"
2018-03-24 02:42:30 +08:00
# onlydeps-with-rdeps <yn>
# package-moves
# pkg-format
# prefix DIR
2019-05-05 18:53:09 +08:00
complete -c emerge -s p -l pretend -d "Display what would be done without doing it"
complete -c emerge -s q -l quiet -d "Use a condensed output"
2018-03-24 02:42:30 +08:00
# quiet-build
# quiet-fail
# quiet-repo-display
# quiet-unmerge-warn
# rage-clean
# read-news
# rebuild-if-new-slot
# rebuild-if-new-rev
# rebuild-if-new-ver
# rebuild-if-unbuilt
# rebuild-binaries
# rebuild-binaries-timestamp TIMESTAMP
# reinstall changed-use
# reinstall-atoms ATOMS
# root-deps
# search-index
# search-similarity PERCENTAGE
complete -c emerge -s w -l select
# selective
2019-05-05 18:53:09 +08:00
complete -c emerge -l skipfirst -d "Remove first pkg in resume list. Use with --resume"
2018-03-24 02:42:30 +08:00
# sync-module <glsa|news|profiles>
2019-05-05 18:53:09 +08:00
complete -c emerge -s t -l tree -d "Show the dependency tree"
2018-03-24 02:42:30 +08:00
# unordered-display
complete -c emerge -s u -l update
# use-ebuild-visibility
# useoldpkg-atoms ATOMS
2019-05-05 18:53:09 +08:00
complete -c emerge -s k -l usepkg -d "Use binary pkg if available"
complete -c emerge -s K -l usepkgonly -d "Only use binary pkgs"
complete -c emerge -s v -l verbose -d "Run in verbose mode"
complete -c emerge -l verbose-conflicts -d "Verbose slot conflicts"
2018-03-24 02:42:30 +08:00
# verbose-slot-rebuilds
2019-05-05 18:53:09 +08:00
complete -c emerge -l with-bdeps -d "Pull in build time dependencies" \
-xa "y n"
2018-03-24 02:42:30 +08:00
# with-bdeps-auto <yn>
# with-test-bdeps