Skip to content

Commit

Permalink
fix(man): Add correct date and version to manpage
Browse files Browse the repository at this point in the history
The previous approach relied on manually updating the version and date
using a Makefile

This approach dynamically gathers the correct version from git and uses
the date of the latest commit in the branch
  • Loading branch information
patrick96 authored and NBonaparte committed Nov 30, 2018
1 parent 669469f commit 6f88fe1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,6 +1,7 @@
/build*
/doc/config
/include/settings.hpp
/man/polybar.1
/polybar
/polybar-msg
/tags
Expand Down
1 change: 1 addition & 0 deletions include/CMakeLists.txt
Expand Up @@ -38,4 +38,5 @@ configure_file(
${CMAKE_CURRENT_LIST_DIR}/settings.hpp
ESCAPE_QUOTES @ONLY)

set(APP_VERSION ${APP_VERSION} PARENT_SCOPE)
set(dirs ${dirs} PARENT_SCOPE)
12 changes: 12 additions & 0 deletions man/CMakeLists.txt
@@ -1,4 +1,16 @@
# Gets the date of the latest commit in the form YYYY-MM-DD
# This date is used in the man page
execute_process(COMMAND git log -1 --date=format:%Y-%m-%d --format=%cd
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE LAST_COMMIT_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE)

set(MAN_PAGES_1 polybar.1)
configure_file(
${CMAKE_CURRENT_LIST_DIR}/${MAN_PAGES_1}.cmake
${CMAKE_CURRENT_LIST_DIR}/${MAN_PAGES_1}
ESCAPE_QUOTES @ONLY)

INSTALL(FILES ${MAN_PAGES_1}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
COMPONENT doc)
2 changes: 1 addition & 1 deletion man/polybar.1 → man/polybar.1.cmake
@@ -1,4 +1,4 @@
.TH polybar 1 2017-01-26 "polybar 3.0.2" "User Manual"
.TH polybar 1 @LAST_COMMIT_DATE@ "polybar @APP_VERSION@" "User Manual"
.SH NAME
polybar \- A fast and easy-to-use tool status bar
.SH SYNOPSIS
Expand Down

0 comments on commit 6f88fe1

Please sign in to comment.