fish-shell/share/completions/apt-mark.fish
Fabian Homborg 04d7d89020 __fish_print_packages: Extract the rest
Of note: The rpm/yum thing seems to be coupled, so I put it into one
function that tries the yum helper and uses the rpm path otherwise.
Zypper is already its own thing, so this should only be used for yum
and probably dnf (does that still have the helper?)

Zypper can be dropped, as that already used a separate function in the file.

Apk can just be inlined - it's literally one line for installed and another for all packages.
2020-12-22 17:10:02 +01:00

34 lines
1.7 KiB
Fish

#completion for apt-mark
function __fish_apt_no_subcommand -d 'Test if apt has yet to be given the subcommand'
for i in (commandline -opc)
if contains -- $i auto manual hold unhold showauto showmanual showhold
return 1
end
end
return 0
end
function __fish_apt_use_package -d 'Test if apt command should have packages as potential completion'
for i in (commandline -opc)
if contains -- $i contains auto manual hold unhold
return 0
end
end
return 1
end
complete -c apt-mark -n __fish_apt_use_package -a '(__fish_print_apt_packages)' -d Package
complete -c apt-mark -s h -l help -d 'Display help and exit'
complete -f -n __fish_apt_no_subcommand -c apt-mark -a auto -d 'Mark a package as automatically installed'
complete -f -n __fish_apt_no_subcommand -c apt-mark -a manual -d 'Mark a package as manually installed'
complete -f -n __fish_apt_no_subcommand -c apt-mark -a hold -d 'Hold a package, prevent automatic installation or removal'
complete -f -n __fish_apt_no_subcommand -c apt-mark -a unhold -d 'Cancel a hold on a package'
complete -f -n __fish_apt_no_subcommand -c apt-mark -a showauto -d 'Show automatically installed packages'
complete -f -n __fish_apt_no_subcommand -c apt-mark -a showmanual -d 'Show manually installed packages'
complete -f -n __fish_apt_no_subcommand -c apt-mark -a showhold -d 'Show held packages'
complete -c apt-mark -s v -l version -d 'Display version and exit'
complete -r -c apt-mark -s c -l config-file -d 'Specify a config file'
complete -r -c apt-mark -s o -l option -d 'Set a config option'
complete -r -c apt-mark -s f -l file -d 'Write package statistics to a file'