Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dnf5.spec
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ It supports RPM packages, modulemd modules, and comps groups & environments.
%dir %{_datadir}/bash-completion/
%dir %{_datadir}/bash-completion/completions/
%{_datadir}/bash-completion/completions/dnf*
%dir %{_datadir}/zsh/
%dir %{_datadir}/zsh/site-functions/
%{_datadir}/zsh/site-functions/_dnf5
%license COPYING.md
%license gpl-2.0.txt
%doc AUTHORS.md CHANGELOG.md CONTRIBUTING.md README.md
Expand Down
4 changes: 4 additions & 0 deletions dnf5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,16 @@ else()
message (STATUS "Using fallback bash completion dir ${BASH_COMPLETION_COMPLETIONSDIR}")
endif()

set(ZSH_COMPLETION_COMPLETIONSDIR "${CMAKE_INSTALL_PREFIX}/share/zsh/site-functions")
message(STATUS "Using zsh completion dir ${ZSH_COMPLETION_COMPLETIONSDIR}")

find_package(toml11 REQUIRED)
if (toml11_VERSION VERSION_LESS 4.0.0)
add_definitions(-DTOML11_COMPAT)
endif()

install(FILES bash-completion/dnf5 DESTINATION ${BASH_COMPLETION_COMPLETIONSDIR})
install(FILES zsh-completion/_dnf5 DESTINATION ${ZSH_COMPLETION_COMPLETIONSDIR})
install(FILES "README.plugins" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/dnf5/plugins" RENAME "README")
install(DIRECTORY "config/usr/" DESTINATION "${CMAKE_INSTALL_PREFIX}" PATTERN ".gitkeep" EXCLUDE)
install(DIRECTORY "config/etc/" DESTINATION "${CMAKE_INSTALL_FULL_SYSCONFDIR}" PATTERN ".gitkeep" EXCLUDE)
Expand Down
9 changes: 9 additions & 0 deletions dnf5/zsh-completion/_dnf5
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#compdef dnf5 dnf

_dnf5() {
local -a completions
completions=("${(@f)$(dnf5 --complete=$((CURRENT-1)) "${words[@]}" 2>/dev/null)}")
compadd -a completions
}

_dnf5 "$@"