revisit gentoo-related completions (#4758)

* revisit gentoo-related completions

- add completion for emaint
- improve completion for emerge
  still incomplete, but an impovement regardless
- improve completion for equery
- add gentoo/portage-related auxiliary functions

* fix spelling

* remove trailing '.'

* remove old '_' invocation and capitalize descriptions

* add number-completion

* remove trailing '.'

* shorter descriptions

* replace sed with fish-builtin and drop deduplication

* batch change capitalization (lower case)

* indent equery descriptions

* batch change capitalization (upper case)
This commit is contained in:
Wilke Schwiedop 2018-03-23 19:42:30 +01:00 committed by Fabian Homborg
parent 316303d777
commit 44e2c28255
9 changed files with 320 additions and 197 deletions

View file

@ -0,0 +1,32 @@
## Global Opts
complete -c emaint -s h -l help -d "Show this help message and exit"
complete -c emaint -s c -l check -d "Check for problems"
complete -c emaint -l version -d "Show program's version number and exit"
complete -c emaint -s f -l fix -d "Attempt to fix problems"
complete -c emaint -s P -l purge -d "Remove the list of failed merges"
## Subcommands
complete -c emaint -n '__fish_use_subcommand' -xa 'all' -d 'Perform all supported commands'
complete -c emaint -n '__fish_use_subcommand' -xa 'binhost' -d 'Scan and generate metadata indexes for binary pkgs'
complete -c emaint -n '__fish_use_subcommand' -xa 'cleanconfmem' -d 'Check and clean the config tracker list for uninstalled pkgs'
complete -c emaint -n '__fish_use_subcommand' -xa 'cleanresume' -d 'Discard emerge --resume merge lists'
complete -c emaint -n '__fish_use_subcommand' -xa 'logs' -d 'Check and clean old logs in the PORT_LOGDIR'
complete -c emaint -n '__fish_use_subcommand' -xa 'merges' -d 'Scan for failed merges and fix them'
complete -c emaint -n '__fish_use_subcommand' -xa 'movebin' -d 'Perform pkg move updates for binary pkgs'
complete -c emaint -n '__fish_use_subcommand' -xa 'moveinst' -d 'Perform pkg move updates for installed and binary pkgs'
complete -c emaint -n '__fish_use_subcommand' -xa 'sync' -d 'Check repos.conf settings and sync repositories'
complete -c emaint -n '__fish_use_subcommand' -xa 'world' -d 'Check and fix problems in the world file'
## Local opts
# cleanlogs
complete -c emaint -n '__fish_seen_subcommand_from cleanlogs' -s t -l time -d "Delete logs older than NUM of days" \
-xa "(seq 0 365)"
complete -c emaint -n '__fish_seen_subcommand_from cleanlogs' -s p -l pretend -d "Output logs that would be deleted"
complete -c emaint -n '__fish_seen_subcommand_from cleanlogs' -s C -l clean -d "Cleans out logs more than 7 days old"
# sync
complete -c emaint -n '__fish_seen_subcommand_from sync' -s a -l auto -d "Sync auto-sync enabled repos only"
complete -c emaint -n '__fish_seen_subcommand_from sync' -s A -l allrepos -d "Sync all repos that have a sync-url defined"
complete -c emaint -n '__fish_seen_subcommand_from sync' -s r -l repo -d "Sync the specified repo" \
-xa "(__fish_portage_print_repository_names)"
complete -c emaint -n '__fish_seen_subcommand_from sync' -l sync-submodule -d "Restrict sync to the specified submodule(s)" \
-xa "glsa news profiles"

View file

@ -1,124 +1,176 @@
# Completions for emerge
#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
# Author: Tassilo Horn <tassilo@member.fsf.org>
function __fish_emerge_print_installed_pkgs -d '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 -u | \
sed 's/-[0-9]\{1,\}\..*$//' | sed -e '/^ *$/d'
return
end
function __fish_emerge_print_sets
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
end
function __fish_emerge_print_all_pkgs -d '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 -u | \
sed 's/-[0-9]\{1,\}\..*$//' | sed -e '/^ *$/d'
return
end
# TODO <ebuild|tbz2file|file|@set|atom>...
function __fish_emerge_possible_args
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
end
function __fish_emerge_use_installed_package -d '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
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
complete -c emerge -xa "(__fish_emerge_possible_args)"
#########################
# Actions
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")'" '\
'@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)'
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 -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")'"'
complete -c emerge -s c -l clean -d "Remove packages that will not affect the functionality of the system"
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 -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 -d "WARNING: Remove the given package"
complete -c emerge -s u -l update -d "Update the given package"
# END Actions
# Actions #
#########################
complete -c emerge -l check-news
complete -c emerge -l clean
complete -c emerge -l config
complete -c emerge -s c -l depclean
complete -c emerge -l deselect
complete -c emerge -s h -l help
complete -c emerge -l info
complete -c emerge -l list-sets
complete -c emerge -l metadata
complete -c emerge -s P -l prune
complete -c emerge -l regen
complete -c emerge -s r -l resume
complete -c emerge -s s -l search
complete -c emerge -s S -l searchdesc
complete -c emerge -l sync
complete -c emerge -s C -l unmerge
complete -c emerge -s V -l version
#########################
# 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"
complete -c emerge -l color -d "Toggle colorized output" -xa \
'y\t"'(_ "Use colors in output")'" '\
'n\t"'(_ "Don't use colors in output")'"'
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"
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")'"'
# END Options
# Options #
#########################
complete -c emerge -s A -l alert -d "Add a terminal bell character ('\a') to all interactive prompts"
#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"
# ask-enter-invalid
# autounmask
# autounmask-backtrack <yn>
# autounmask-continue
# autounmask-only
# autounmask-unrestricted-atoms
# autounmask-keep-keywords
# autounmask-keep-masks
# autounmask-write
complete -c emerge -l backtrack
complete -c emerge -s b -l buildpkg -d "Build a binary pkg additionally"
# 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
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
# complete-graph-if-new-use <yn>
# complete-graph-if-new-ver <yn>
# config-root DIR
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"
# depclean-lib-check
# digest
# dynamic-deps <yn>
complete -c emerge -s e -l emptytree -d "Reinstall all world pkgs"
# exclude ATOMS
complete -c emerge -l exclude
# fail-clean
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"
# fuzzy-search
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"
# ignore-build-slot-operator-deps <yn>
# ignore-soname-deps <yn>
complete -c emerge -l jobs
complete -c emerge -l keep-going
# load-average
# misspell-suggestion
# newrepo
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"
# usepkg-exclude ATOMS
# rebuild-exclude ATOMS
# rebuild-ignore ATOMS
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"
# onlydeps-with-rdeps <yn>
# package-moves
# pkg-format
# prefix DIR
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"
# 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
complete -c emerge -l skipfirst -d "Remove first pkg in resume list. Use with --resume"
# sync-module <glsa|news|profiles>
complete -c emerge -s t -l tree -d "Show the dependency tree"
# unordered-display
complete -c emerge -s u -l update
# use-ebuild-visibility
# useoldpkg-atoms ATOMS
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"
# verbose-conflicts
# verbose-slot-rebuilds
complete -c emerge -l with-bdeps -d "Pull in build time dependencies" \
-xa "y n"
# with-bdeps-auto <yn>
# with-test-bdeps

View file

@ -1,104 +1,123 @@
# Completions for Gentoo's equery tool
# Author: Tassilo Horn <tassilo@member.fsf.org>
function __fish_equery_print_installed_pkgs -d '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 -u | sed 's/-[0-9]\{1,\}\..*$//'
return
end
# TODO unused
function __fish_equery_print_format
printf "%s\t%s\n" \
'$cp' "contains the category and the package name only (e.g 'app-portage/gentoolkit')" \
'$cpv' "contains the category, the package name and the full version (e.g. 'app-portage/gentoolkit-0.3.0_rc10-r1')" \
'$category' "contains just the category (e.g. 'app-portage')" \
'$name' "contains just the package name (e.g. 'gentoolkit')" \
'$version' "contains the package version (without the revision) (e.g. '0.3.0_rc10')" \
'$revision' "contains the package revision (e.g. 'r1')" \
'$fullversion' "contains the package version including its revision (e.g. '0.3.0_rc10-r1')" \
'$slot' "contains the package's slot" \
'$repo' "contains the name of the package's repository (e.g. 'gentoo')" \
'$mask' "the mask-status field (~M-??)" \
'$mask2' "contains a verbose description of the packages masking status" \
'$location' "the location field (IPO-)"
end
function __fish_equery_print_all_pkgs -d '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 -u | sed 's/-[0-9]\{1,\}\..*$//'
return
end
end
## Global Opts
complete -c equery -s h -l help -d "Displays a help message"
complete -c equery -s q -l quiet -d "Minimal output"
complete -c equery -s C -l no-color -d "Turns off colors"
complete -c equery -s N -l no-pipe -d "Turns off pipe detection"
complete -c equery -s V -l version -d "Display version information"
function __fish_equery_print_all_categories -d 'Prints completions for all available categories on the system from /usr/portage'
if test -d /usr/portage
find /usr/portage/ -maxdepth 1 -type d | cut -d'/' -f4 | sed 's/^\(distfiles\|profiles\|eclass\).*$//' | sort -u | sed 's/-[0-9]\{1,\}\..*$//'
return
end
end
## Subcommands
complete -c equery -n '__fish_use_subcommand' -xa 'belongs' -d "List all packages owning file(s)"
complete -c equery -n '__fish_use_subcommand' -xa 'changes' -d "List changelog entries for ATOM"
complete -c equery -n '__fish_use_subcommand' -xa 'check' -d "Check MD5sums and timestamps of package"
complete -c equery -n '__fish_use_subcommand' -xa 'depends' -d "List all packages depending on specified package"
complete -c equery -n '__fish_use_subcommand' -xa 'depgraph' -d "Display a dependency tree for package"
complete -c equery -n '__fish_use_subcommand' -xa 'files' -d "List files owned by package"
complete -c equery -n '__fish_use_subcommand' -xa 'has' -d "List pkgs for matching ENVIRONMENT data"
complete -c equery -n '__fish_use_subcommand' -xa 'hasuse' -d "List pkgs with specified useflag"
complete -c equery -n '__fish_use_subcommand' -xa 'keywords' -d "Display keywords for specified PKG"
complete -c equery -n '__fish_use_subcommand' -xa 'list' -d "List all packages matching pattern"
complete -c equery -n '__fish_use_subcommand' -xa 'meta' -d "Display metadata about PKG"
complete -c equery -n '__fish_use_subcommand' -xa 'size' -d "Print size of files contained in package"
complete -c equery -n '__fish_use_subcommand' -xa 'uses' -d "Display USE flags for package"
complete -c equery -n '__fish_use_subcommand' -xa 'which' -d "Print full path to ebuild for package"
#########################################################################
# Global Opts
complete -c equery -s q -l quit -d "causes minimal output to be emitted"
complete -c equery -s C -l nocolor -d "turns off colours"
complete -c equery -s h -l help -d "displays a help summary"
complete -c equery -s V -l version -d "displays the equery version"
complete -c equery -s N -l no-pipe -d "turns off pipe detection"
# END Global Opts
#########################################################################
## Arguments
complete -c equery -n '__fish_seen_subcommand_from changes depends depgraph meta which' -xa '(__fish_portage_print_available_pkgs)'
complete -c equery -n '__fish_seen_subcommand_from check files uses size' -xa '(__fish_portage_print_installed_pkgs)'
#########################################################################
# Subcommands
complete -c equery -n '__fish_use_subcommand' -xa 'belongs\t"'(_ "list all packages owning file(s)")'"'
complete -c equery -n '__fish_use_subcommand' -xa 'check\t"'(_ "check MD5sums and timestamps of package")'"'
complete -c equery -n '__fish_use_subcommand' -xa 'depends\t"'(_ "list all packages depending on specified package")'"'
complete -c equery -n '__fish_use_subcommand' -xa 'depgraph\t"'(_ "display a dependency tree for package")'"'
complete -c equery -n '__fish_use_subcommand' -xa 'files\t"'(_ "list files owned by package")'"'
complete -c equery -n '__fish_use_subcommand' -xa 'hasuse\t"'(_ "list all packages with specified useflag")'"'
complete -c equery -n '__fish_use_subcommand' -xa 'list\t"'(_ "list all packages matching pattern")'"'
complete -c equery -n '__fish_use_subcommand' -xa 'size\t"'(_ "print size of files contained in package")'"'
complete -c equery -n '__fish_use_subcommand' -xa 'uses\t"'(_ "display USE flags for package")'"'
complete -c equery -n '__fish_use_subcommand' -xa 'which\t"'(_ "print full path to ebuild for package")'"'
# END Subcommands
#########################################################################
#########################################################################
# Local opts
## Local opts
# belongs
complete -c equery -n '__fish_seen_subcommand_from belongs' -s c -l category -xa '(__fish_equery_print_all_categories)' -d "only search in given category"
complete -c equery -n '__fish_seen_subcommand_from belongs' -s f -l full-regex -d "supplied query is a regex"
complete -c equery -n '__fish_seen_subcommand_from belongs' -s e -l earlyout -d "stop when first match found"
complete -c equery -n '__fish_seen_subcommand_from belongs' -s f -l full-regex -d "Supplied query is a regex"
complete -c equery -n '__fish_seen_subcommand_from belongs' -s e -l early-out -d "Stop when first match is found"
complete -c equery -n '__fish_seen_subcommand_from belongs' -s n -l name-only -d "Don't print the version"
# changes
complete -c equery -n '__fish_seen_subcommand_from changes' -s l -l latest -d "Display only the latest ChangeLog entry"
complete -c equery -n '__fish_seen_subcommand_from changes' -s f -l full -d "Display the full ChangeLog"
#complete -c equery -n '__fish_seen_subcommand_from changes' -l limit=NUM -d "Limit the number of entries displayed (with --full)"
#complete -c equery -n '__fish_seen_subcommand_from changes' -l from=VER -d "Set which version to display from"
#complete -c equery -n '__fish_seen_subcommand_from changes' -l to=VER -d "Set which version to display to"
# check
complete -c equery -n '__fish_seen_subcommand_from check' -s f -l full-regex -d "Query is a regular expression"
complete -c equery -n '__fish_seen_subcommand_from check' -s o -l only-failures -d "Only display packages that do not pass"
# depends
complete -c equery -n '__fish_seen_subcommand_from depends' -s a -l all-packages -d "search in all available packages (slow)"
complete -c equery -n '__fish_seen_subcommand_from depends' -s d -l direct -d "search direct dependencies only (default)"
complete -c equery -n '__fish_seen_subcommand_from depends' -s D -l indirect -d "search indirect dependencies (very slow)"
complete -c equery -n '__fish_seen_subcommand_from depends' -s a -l all-packages -d "Include dependencies that are not installed (slow)"
complete -c equery -n '__fish_seen_subcommand_from depends' -s D -l indirect -d "Search both direct and indirect dependencies"
#complete -c equery -n '__fish_seen_subcommand_from depends' -l depth=N -d "Limit indirect dependency tree to specified depth"
# depgraph
complete -c equery -n '__fish_seen_subcommand_from depgraph' -s U -l no-useflags -d "do not show USE flags"
complete -c equery -n '__fish_seen_subcommand_from depgraph' -s l -l linear -d "do not use fancy formatting"
complete -c equery -n '__fish_seen_subcommand_from depgraph' -s A -l no-atom -d "Do not show dependency atom"
complete -c equery -n '__fish_seen_subcommand_from depgraph' -s M -l no-mask -d "Do not show masking status"
complete -c equery -n '__fish_seen_subcommand_from depgraph' -s U -l no-useflags -d "Do not show USE flags"
complete -c equery -n '__fish_seen_subcommand_from depgraph' -s l -l linear -d "Do not format the graph by indenting dependencies"
#complete -c equery -n '__fish_seen_subcommand_from depgraph' -l depth=N -d "Limit dependency graph to specified depth"
# files
complete -c equery -n '__fish_seen_subcommand_from files' -l timestamp -d "output the timestamp of each file"
complete -c equery -n '__fish_seen_subcommand_from files' -l md5sum -d "output the md5sum of each file"
complete -c equery -n '__fish_seen_subcommand_from files' -l type -d "output the type of each file"
complete -c equery -n '__fish_seen_subcommand_from files' -l filter -xa "dir obj sym dev fifo path conf cmd doc man info" -d "filter output based on files type or path (comma separated list)"
complete -c equery -n '__fish_seen_subcommand_from files' -s m -l md5sum -d "Include MD5 sum in output"
complete -c equery -n '__fish_seen_subcommand_from files' -s s -l timestamp -d "Include timestamp in output"
complete -c equery -n '__fish_seen_subcommand_from files' -s t -l type -d "Include file type in output"
complete -c equery -n '__fish_seen_subcommand_from files' -l tree -d "Display results in a tree (turns off other options)"
# TODO comma separated list
complete -c equery -n '__fish_seen_subcommand_from files' -s f -l filter -d "Filter output by file type (comma separated list)" \
-xa "dir obj sym dev fifo path conf cmd doc man info"
# hasuse
complete -c equery -n '__fish_seen_subcommand_from hasuse' -s i -l installed -d "search installed packages (default)"
complete -c equery -n '__fish_seen_subcommand_from hasuse' -s I -l exclude-installed -d "do not search installed packages"
complete -c equery -n '__fish_seen_subcommand_from hasuse' -s p -l portage-tree -d "also search in portage tree (/usr/portage)"
complete -c equery -n '__fish_seen_subcommand_from hasuse' -s o -l overlay-tree -d "also search in overlay tree (/usr/local/portage)"
# has + hasuse
complete -c equery -n '__fish_seen_subcommand_from has hasuse' -s I -l exclude-installed -d "Exclude installed packages from search path"
complete -c equery -n '__fish_seen_subcommand_from has hasuse' -s o -l overlay-tree -d "Include overlays in search path"
complete -c equery -n '__fish_seen_subcommand_from has hasuse' -s p -l portage-tree -d "Include entire portage tree in search path"
#complete -c equery -n '__fish_seen_subcommand_from has hasuse' -s F -l format=TMPL -d "Specify a custom output format"
# keywords
# TODO
# list
complete -c equery -n '__fish_seen_subcommand_from list' -s i -l installed -d "search installed packages (default)"
complete -c equery -n '__fish_seen_subcommand_from list' -s I -l exclude-installed -d "do not search installed packages"
complete -c equery -n '__fish_seen_subcommand_from list' -s p -l portage-tree -d "also search in portage tree (/usr/portage)"
complete -c equery -n '__fish_seen_subcommand_from list' -s o -l overlay-tree -d "also search in overlay tree (/usr/local/portage)"
complete -c equery -n '__fish_seen_subcommand_from list' -s f -l full-regex -d "query is a regular expression"
complete -c equery -n '__fish_seen_subcommand_from list' -s e -l exact-name -d "list only those packages that exactly match"
complete -c equery -n '__fish_seen_subcommand_from list' -s d -l duplicates -d "only list installed duplicate packages"
complete -c equery -n '__fish_seen_subcommand_from list' -s d -l duplicates -d "List only installed duplicate packages"
complete -c equery -n '__fish_seen_subcommand_from list' -s b -l binpkgs-missing -d "List only installed packages without a corresponding binary package"
complete -c equery -n '__fish_seen_subcommand_from list' -s f -l full-regex -d "Query is a regular expression"
complete -c equery -n '__fish_seen_subcommand_from list' -s m -l mask-reason -d "Include reason for package mask"
complete -c equery -n '__fish_seen_subcommand_from list' -s I -l exclude-installed -d "Exclude installed packages from output"
complete -c equery -n '__fish_seen_subcommand_from list' -s o -l overlay-tree -d "List packages in overlays"
complete -c equery -n '__fish_seen_subcommand_from list' -s p -l portage-tree -d "List packages in the main portage tree"
#complete -c equery -n '__fish_seen_subcommand_from list' -s F -l format=TMPL -d "Specify a custom output format"
# meta
complete -c equery -n '__fish_seen_subcommand_from meta' -s d -l description -d "Show an extended package description"
complete -c equery -n '__fish_seen_subcommand_from meta' -s H -l herd -d "Show the herd(s) for the package"
complete -c equery -n '__fish_seen_subcommand_from meta' -s k -l keywords -d "Show keywords for all matching package versions"
complete -c equery -n '__fish_seen_subcommand_from meta' -s l -l license -d "Show licenses for the best maching version"
complete -c equery -n '__fish_seen_subcommand_from meta' -s m -l maintainer -d "Show the maintainer(s) for the package"
complete -c equery -n '__fish_seen_subcommand_from meta' -s S -l stablreq -d "Show STABLEREQ arches (cc's) for all matching package versions"
complete -c equery -n '__fish_seen_subcommand_from meta' -s u -l useflags -d "Show per-package USE flag descriptions"
complete -c equery -n '__fish_seen_subcommand_from meta' -s U -l upstream -d "Show package's upstream information"
complete -c equery -n '__fish_seen_subcommand_from meta' -s x -l xml -d "Show the plain metadata.xml file"
# size
complete -c equery -n '__fish_seen_subcommand_from size' -s b -l bytes -d "report size in bytes"
complete -c equery -n '__fish_seen_subcommand_from size' -s b -l bytes -d "Report size in bytes"
complete -c equery -n '__fish_seen_subcommand_from size' -s f -l full-regex -d "Query is a regular expression"
# uses
complete -c equery -n '__fish_seen_subcommand_from uses' -s a -l all -d "include non-installed packages"
# END Local opts
#########################################################################
complete -c equery -n '__fish_seen_subcommand_from uses' -s a -l all -d "Include all package versions"
complete -c equery -n '__fish_seen_subcommand_from uses' -s i -l ignore-l10n -d "Don't show l10n USE flags"
#########################################################################
# Arguments
# Commands applied to a package which doesn't need to be installed
complete -c equery -n '__fish_seen_subcommand_from depends depgraph hasuse which' -xa '(__fish_equery_print_all_pkgs)'
# Commands applied to a package which has to be installed
complete -c equery -n '__fish_seen_subcommand_from check files uses size' -xa '(__fish_equery_print_installed_pkgs)'
# END Arguments
#########################################################################
# which
complete -c equery -n '__fish_seen_subcommand_from which' -s m -l include-masked -d "Return highest version ebuild available"
complete -c equery -n '__fish_seen_subcommand_from which' -s e -l ebuild -d "Print the ebuild"

View file

@ -0,0 +1,3 @@
function __fish_portage_print_available_categories --description 'Print all available categories'
cat (__fish_portage_print_repository_paths)/profiles/categories ^ /dev/null
end

View file

@ -0,0 +1,3 @@
function __fish_portage_print_available_pkgs --description 'Print all available packages'
find (__fish_portage_print_repository_paths) -mindepth 2 -maxdepth 2 -type d ! '(' '(' -path '*/eclass/*' -o -path '*/metadata/*' -o -path '*/profiles/*' -o -path '*/.*/*' ')' -prune ')' -printf '%P\n'
end

View file

@ -0,0 +1,3 @@
function __fish_portage_print_installed_categories --description 'Print all installed categories'
find /var/db/pkg -mindepth 1 -maxdepth 1 -type d -printf '%P\n'
end

View file

@ -0,0 +1,3 @@
function __fish_portage_print_installed_pkgs --description 'Print all installed packages (non-deduplicated)'
find /var/db/pkg -mindepth 2 -maxdepth 2 -type d -printf '%P\n' | string replace -r -- '-[0-9][0-9.]*.*$' ''
end

View file

@ -0,0 +1,4 @@
function __fish_portage_print_repository_names --description 'Print the names of all configured repositories'
# repos.conf may be a file or a directory
find /etc/portage/repos.conf -type f -exec sed -ne '/^[[:blank:]]*\[[[:alnum:]_][[:alnum:]_-]*\]/{s!^.*\[\(.*\)\].*$!\1!; /DEFAULT/!p}' '{}' +
end

View file

@ -0,0 +1,4 @@
function __fish_portage_print_repository_paths --description 'Print the paths of all configured repositories'
# repos.conf may be a file or a directory
find /etc/portage/repos.conf -type f -exec awk 'BEGIN { FS="[[:blank:]]*=[[:blank:]]*" } $1 == "location" { print $2 }' '{}' +
end