fish-shell/share/completions/apt.fish

85 lines
2.9 KiB
Fish
Raw Normal View History

2015-04-09 00:49:58 +08:00
# Completions for the `apt` command
set -l all_subcmds update upgrade full-upgrade search list install show remove edit-sources purge changelog autoremove depends rdepends
set -l pkg_subcmds install upgrade full-upgrade show search purge changelog policy depends rdepends
set -l installed_pkg_subcmds remove
set -l handle_file_pkg_subcmds install
2018-05-21 03:07:56 +08:00
function __fish_apt_subcommand --no-scope-shadowing
set subcommand $argv[1]
set -e argv[1]
complete -f -c apt -n "not __fish_seen_subcommand_from $all_subcmds" -a $subcommand $argv
end
function __fish_apt_option
set subcommand $argv[1]
set -e argv[1]
2018-05-21 03:07:56 +08:00
complete -f -c apt -n "__fish_seen_subcommand_from $subcommand" $argv
end
complete -c apt -f
complete -k -c apt -n "__fish_seen_subcommand_from $pkg_subcmds" -a '(__fish_print_packages | head -n 250 | sort)'
complete -c apt -n "__fish_seen_subcommand_from $installed_pkg_subcmds" -a '(__fish_print_packages --installed | string match -re -- "(?:\\b|_)"(commandline -ct | string escape --style=regex) | head -n 250)' -d Package
complete -k -c apt -n "__fish_seen_subcommand_from $handle_file_pkg_subcmds" -a '(__fish_complete_suffix .deb)'
2015-04-09 00:49:58 +08:00
# Support flags
complete -f -c apt -s h -l help -d 'Display help'
complete -f -c apt -s v -l version -d 'Display version and exit'
2015-04-09 00:49:58 +08:00
# General options
complete -x -c apt -s o -l option -d 'Set a configuration option'
complete -r -c apt -s c -l config-file -d 'Configuration file'
complete -x -c apt -s t -d 'Target release'
2015-04-09 00:49:58 +08:00
# List
__fish_apt_subcommand list -d 'List packages'
__fish_apt_option list -l installed -d 'Installed packages'
__fish_apt_option list -l upgradable -d 'Upgradable packages'
__fish_apt_option list -l all-versions -d 'Show all versions of any package'
2015-04-09 00:49:58 +08:00
# Search
__fish_apt_subcommand search -r -d 'Search for packages'
2015-04-09 00:49:58 +08:00
# Search
__fish_apt_subcommand show -r -d 'Show package information'
2015-04-09 00:49:58 +08:00
# Install
__fish_apt_subcommand install -r -d 'Install packages'
__fish_apt_option install -l reinstall -d 'Reinstall package'
2015-04-09 00:49:58 +08:00
# Remove
__fish_apt_subcommand remove -r -d 'Remove packages'
2015-04-09 00:49:58 +08:00
# Edit sources
__fish_apt_subcommand edit-sources -d 'Edit sources list'
2015-04-09 00:49:58 +08:00
# Update
__fish_apt_subcommand update -x -d 'Update package list'
2015-04-09 00:49:58 +08:00
# Upgrade
__fish_apt_subcommand upgrade -r -d 'Upgrade packages'
2015-04-09 00:49:58 +08:00
# Full Upgrade
__fish_apt_subcommand full-upgrade -r -d 'Upgrade packages, removing others when needed'
# Purge
__fish_apt_subcommand purge -x -d 'Remove packages and delete their config files'
# Changelog
__fish_apt_subcommand changelog -r -d 'Download and display package changelog'
# Autoremove
__fish_apt_subcommand autoremove -d 'Remove packages no longer needed as dependencies'
# Policy
__fish_apt_subcommand policy -x -d 'Display source or package priorities'
# Depends
__fish_apt_subcommand depends -r -d 'List package dependencies'
# Rdepends
__fish_apt_subcommand rdepends -r -d 'List package reverse dependencies'
functions -e __fish_apt_subcommand __fish_apt_option