forked from fish-shell/fish-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
revisit gentoo-related completions (fish-shell#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)
- Loading branch information
Showing
9 changed files
with
325 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,124 +1,176 @@ | ||
# Completions for emerge | ||
|
||
# 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 | ||
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 | ||
#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 | ||
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_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 | ||
# 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_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 |
Oops, something went wrong.