Skip to content

Commit

Permalink
csfilter-kfp: install a simple man page
Browse files Browse the repository at this point in the history
... generated from the output of `--help`

Related: https://issues.redhat.com/browse/OSH-736
Closes: #201
  • Loading branch information
kdudka committed Aug 29, 2024
1 parent 1708d5e commit 16f81cf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
2 changes: 2 additions & 0 deletions doc/csfilter-kfp.h2m
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[NAME]
csfilter-kfp - tool to filter out known false positives in scan results
4 changes: 3 additions & 1 deletion make-srpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ make version.cc
%cmake3 \\
-DCSGREP_STATIC=%{?with_static:ON} \\
-DPYCSDIFF_PYTHON2=%{?with_python2:ON} \\
-DPYCSDIFF_PYTHON3=%{?with_python3:ON}
-DPYCSDIFF_PYTHON3=%{?with_python3:ON} \\
-DVERSION='%{name}-%{version}-%{release}'
%cmake3_build
%install
Expand All @@ -210,6 +211,7 @@ make version.cc
%{_bindir}/cstrans-df-run
%{_datadir}/%{name}
%{_mandir}/man1/csdiff.1*
%{_mandir}/man1/csfilter-kfp.1*
%{_mandir}/man1/csgrep.1*
%{_mandir}/man1/cshtml.1*
%{_mandir}/man1/cslinker.1*
Expand Down
19 changes: 18 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ install(TARGETS
DESTINATION ${CMAKE_INSTALL_BINDIR})

# install the csfilter-kfp script
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/csfilter-kfp
${CMAKE_CURRENT_BINARY_DIR}/csfilter-kfp
@ONLY)
install(PROGRAMS
csfilter-kfp
${CMAKE_CURRENT_BINARY_DIR}/csfilter-kfp
DESTINATION ${CMAKE_INSTALL_BINDIR})

# optionally build statically linked csgrep-static
Expand Down Expand Up @@ -190,6 +194,19 @@ if(HELP2MAN)
create_manpage(cslinker)
create_manpage(cssort)
create_manpage(cstrans-df-run)

# create/install the csfilter-kfp.1 man page
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/csfilter-kfp.1"
COMMAND env LC_ALL=C ${HELP2MAN} --no-info --section 1
--include "${CMAKE_SOURCE_DIR}/doc/csfilter-kfp.h2m"
${CMAKE_CURRENT_BINARY_DIR}/csfilter-kfp
> csfilter-kfp.1 || rm -f csfilter-kfp.1
COMMENT "Generating csfilter-kfp man page"
VERBATIM)
add_custom_target(csfilter-kfp.1 ALL DEPENDS
"${CMAKE_CURRENT_BINARY_DIR}/csfilter-kfp.1")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/csfilter-kfp.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
else()
message(STATUS "help2man not found - documentation will NOT be built")
endif()
4 changes: 4 additions & 0 deletions src/csfilter-kfp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ def main():
"-n", "--dry-run", action="store_true",
help="do not execute anything, only print the shell script that would be executed")

parser.add_argument(
"--version", action="version", version="@VERSION@",
help="print the version string and exit")

# parse command-line arguments
args = parser.parse_args()

Expand Down

0 comments on commit 16f81cf

Please sign in to comment.