Skip to content

Commit e43e7c9

Browse files
tuesd4yjoto
authored andcommitted
Add install completions step to the makefile
1 parent f60ee76 commit e43e7c9

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,27 @@ add_subdirectory(man)
290290
add_subdirectory(src)
291291

292292

293+
#-----------------------------------------------------------------------------
294+
#
295+
# Command line completions
296+
#
297+
# The completion files are installed into the locations where bash and zsh
298+
# look for them by default. Packagers can override the directories, Debian
299+
# for instance uses share/zsh/vendor-completions. Relative paths are
300+
# interpreted relative to the install prefix, absolute paths are used as is.
301+
#
302+
#-----------------------------------------------------------------------------
303+
option(INSTALL_COMPLETIONS "Install bash and zsh command line completions" ON)
304+
305+
set(BASH_COMPLETION_DIR "share/bash-completion/completions" CACHE STRING "Installation directory for the bash completion file")
306+
set(ZSH_COMPLETION_DIR "share/zsh/site-functions" CACHE STRING "Installation directory for the zsh completion file")
307+
308+
if(INSTALL_COMPLETIONS)
309+
install(FILES bash_completion/osmium DESTINATION ${BASH_COMPLETION_DIR})
310+
install(FILES zsh_completion/_osmium DESTINATION ${ZSH_COMPLETION_DIR})
311+
endif()
312+
313+
293314
#-----------------------------------------------------------------------------
294315
#
295316
# Tests

cmake/test_install.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ set(OSMIUM_INSTALL_FILES
2727
share/man/man5/osmium-file-formats.5
2828
share/man/man5/osmium-index-types.5
2929
share/man/man5/osmium-output-headers.5
30+
share/bash-completion/completions/osmium
31+
share/zsh/site-functions/_osmium
3032
bin/osmium
3133
)
3234

0 commit comments

Comments
 (0)