2015-04-08 16:49:58 +00:00
|
|
|
# Completions for the `apt` command
|
|
|
|
|
2017-10-11 17:17:35 +00:00
|
|
|
function __fish_apt_no_subcommand -d 'Test if apt has yet to be given the subcommand'
|
2015-04-08 16:49:58 +00:00
|
|
|
for i in (commandline -opc)
|
2017-01-24 18:55:42 +00:00
|
|
|
if contains -- $i update upgrade full-upgrade search list install show remove edit-sources purge changelog autoremove
|
2015-04-08 16:49:58 +00:00
|
|
|
return 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return 0
|
|
|
|
end
|
|
|
|
|
2017-10-11 17:17:35 +00:00
|
|
|
function __fish_apt_use_package -d 'Test if apt command should have packages as potential completion'
|
2015-04-08 16:49:58 +00:00
|
|
|
for i in (commandline -opc)
|
2018-01-13 03:03:36 +00:00
|
|
|
if contains -- $i install remove upgrade full-upgrade show search purge changelog policy
|
2015-04-08 16:49:58 +00:00
|
|
|
return 0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return 1
|
|
|
|
end
|
|
|
|
|
|
|
|
function __fish_apt_subcommand
|
2017-08-21 20:30:10 +00:00
|
|
|
set subcommand $argv[1]
|
|
|
|
set -e argv[1]
|
2015-04-08 16:49:58 +00:00
|
|
|
complete -f -c apt -n '__fish_apt_no_subcommand' -a $subcommand $argv
|
|
|
|
end
|
|
|
|
|
2017-10-11 17:17:35 +00:00
|
|
|
function __fish_apt_using_subcommand -d 'Test if given subcommand is used'
|
2017-08-21 20:30:10 +00:00
|
|
|
for i in (commandline -opc)
|
|
|
|
if contains -- $i $argv
|
|
|
|
return 0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return 1
|
|
|
|
end
|
|
|
|
|
|
|
|
function __fish_apt_option
|
|
|
|
set subcommand $argv[1]
|
|
|
|
set -e argv[1]
|
|
|
|
complete -f -c apt -n "__fish_apt_using_subcommand $subcommand" $argv
|
|
|
|
end
|
|
|
|
|
2017-10-11 17:17:35 +00:00
|
|
|
complete -c apt -n '__fish_apt_use_package' -a '(__fish_print_packages)' -d 'Package'
|
2015-04-08 16:49:58 +00:00
|
|
|
|
|
|
|
# Support flags
|
2017-10-11 17:17:35 +00:00
|
|
|
complete -x -f -c apt -s h -l help -d 'Display help'
|
|
|
|
complete -x -f -c apt -s v -l version -d 'Display version and exit'
|
2015-04-08 16:49:58 +00:00
|
|
|
|
|
|
|
# General options
|
2017-10-11 17:17:35 +00:00
|
|
|
complete -f -c apt -s o -l option -d 'Set a configuration option'
|
|
|
|
complete -f -c apt -s c -l config-file -d 'Configuration file'
|
|
|
|
complete -f -c apt -s t -d 'Target release'
|
2015-04-08 16:49:58 +00:00
|
|
|
|
|
|
|
# List
|
2017-10-11 17:17:35 +00:00
|
|
|
__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-08 16:49:58 +00:00
|
|
|
|
|
|
|
# Search
|
2017-10-11 17:17:35 +00:00
|
|
|
__fish_apt_subcommand search -r -d 'Search for packages'
|
2015-04-08 16:49:58 +00:00
|
|
|
|
|
|
|
# Search
|
2017-10-11 17:17:35 +00:00
|
|
|
__fish_apt_subcommand show -r -d 'Show package information'
|
2015-04-08 16:49:58 +00:00
|
|
|
|
|
|
|
# Install
|
2017-10-11 17:17:35 +00:00
|
|
|
__fish_apt_subcommand install -r -d 'Install packages'
|
2015-04-08 16:49:58 +00:00
|
|
|
|
|
|
|
# Remove
|
2017-10-11 17:17:35 +00:00
|
|
|
__fish_apt_subcommand remove -r -d 'Remove packages'
|
2015-04-08 16:49:58 +00:00
|
|
|
|
|
|
|
# Edit sources
|
2017-10-11 17:17:35 +00:00
|
|
|
__fish_apt_subcommand edit-sources -d 'Edit sources list'
|
2015-04-08 16:49:58 +00:00
|
|
|
|
|
|
|
# Update
|
2017-10-11 17:17:35 +00:00
|
|
|
__fish_apt_subcommand update -x -d 'Update package list'
|
2015-04-08 16:49:58 +00:00
|
|
|
|
|
|
|
# Upgrade
|
2017-10-11 17:17:35 +00:00
|
|
|
__fish_apt_subcommand upgrade -r -d 'Upgrade packages'
|
2015-04-08 16:49:58 +00:00
|
|
|
|
|
|
|
# Full Upgrade
|
2017-10-11 17:17:35 +00:00
|
|
|
__fish_apt_subcommand full-upgrade -r -d 'Upgrade packages, removing others when needed'
|
2016-05-31 22:56:22 +00:00
|
|
|
|
|
|
|
# Purge
|
2017-10-11 17:17:35 +00:00
|
|
|
__fish_apt_subcommand purge -x -d 'Remove packages and delete their config files'
|
2017-01-03 18:43:55 +00:00
|
|
|
|
|
|
|
# Changelog
|
2017-10-11 17:17:35 +00:00
|
|
|
__fish_apt_subcommand changelog -r -d 'Download and display package changelog'
|
2017-01-24 18:55:42 +00:00
|
|
|
|
|
|
|
# Autoremove
|
2017-10-11 17:17:35 +00:00
|
|
|
__fish_apt_subcommand autoremove -d 'Remove packages no longer needed as dependencies'
|
2018-01-13 03:03:36 +00:00
|
|
|
|
|
|
|
# Policy
|
|
|
|
__fish_apt_subcommand policy -x -d 'Display source or package priorities'
|