# dnf completion -*- shell-script -*- # # This file is part of dnf. # # Copyright 2013 (C) Elad Alfassa # Copyright 2014-2015 (C) Igor Gnatenko # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA __dnf_main_options=" -4 -6 -b -c -C -d -e -h -q -R -v -x -y --advisory --advisories --allowerasing --assumeno --assumeyes --best --bugfix --bz --cacheonly --config --color --cve --debuglevel --debugsolver --disableexcludes --disableplugin --disableexcludepkgs --disablerepo --downloadonly --destdir --downloaddir --errorlevel --enableplugin --enablerepo --enhancement --exclude --excludepkgs --help --help-cmd --installroot --newpackage --nodocs --nogpgcheck --noplugins --noautoremove --obsoletes --quiet --randomwait --refresh --releasever --repofrompath --repo --repoid --rpmverbosity --sec-severity --secseverity --security --setopt --skip-broken --showduplicates --verbose --version " __dnf_history_subcmds="info list redo rollback undo userinstalled" __dnf_secseverity_subcmds='Critical Important Low Moderate' __dnf_clean_subcmds="all dbcache expire-cache metadata packages" __dnf_module_subcmds="install remove update enable disable reset provides list info repoquery" __dnf_repoquery_subcmds=" -a -f -i -l -s --all --arch --archlist --available --alldeps --conflicts --deplist --duplicates --exactdeps --extras --envra --enhances --file --groupmember --installed --installonly --info --latest-limit --list --location --nevra --nvr --provides --qf --queryformat --querytags --recent --requires-pre --recommends --requires --recursive --resolve --source --suggests --supplements --show-duplicates --srpm --tree --upgrades --unneeded --unsatisfied --userinstalled --whatconflicts --whatobsoletes --whatprovides --whatrequires --whatrecommends --whatenhances --whatsuggests --whatsupplements " __dnf_repopkgs_subcmds=" check-update info install list move-to remove-or-reinstall remove-or-distro-sync reinstall reinstall-old upgrade upgrade-to " __dnf_cache_file="/var/cache/dnf/packages.db" _dnf_query_db() { local table=$1 local prefix=$2 local query="select pkg from $table where pkg like \"$prefix%\"" if [ "$table" = "available" ]; then # The available table contains both installed and non-installed # packages. Exclude the installed packages. query="$query and pkg not in (select pkg from installed)" fi sqlite3 -batch -init /dev/null "$__dnf_cache_file" "$query" } __dnf_python_exec= _dnf_set_python_exec() { if [[ "$( readlink /usr/bin/dnf )" == "dnf-2" ]]; then __dnf_python_exec="/usr/bin/python2" else if [ -x /usr/libexec/platform-python ]; then __dnf_python_exec="/usr/libexec/platform-python" else __dnf_python_exec="/usr/bin/python3" fi fi } _dnf_commands_helper() { local helper_cmd="import sys; from dnf.cli import completion_helper as ch; ch.main(sys.argv[1:])" local helper_opts="-d 0 -q -C --assumeno --nogpgcheck" "${__dnf_python_exec}" -c "$helper_cmd" "$@" $helper_opts 2>/dev/null