Skip to content

Commit 16f81cf

Browse files
committed
csfilter-kfp: install a simple man page
... generated from the output of `--help` Related: https://issues.redhat.com/browse/OSH-736 Closes: #201
1 parent 1708d5e commit 16f81cf

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

doc/csfilter-kfp.h2m

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[NAME]
2+
csfilter-kfp - tool to filter out known false positives in scan results

make-srpm.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ make version.cc
189189
%cmake3 \\
190190
-DCSGREP_STATIC=%{?with_static:ON} \\
191191
-DPYCSDIFF_PYTHON2=%{?with_python2:ON} \\
192-
-DPYCSDIFF_PYTHON3=%{?with_python3:ON}
192+
-DPYCSDIFF_PYTHON3=%{?with_python3:ON} \\
193+
-DVERSION='%{name}-%{version}-%{release}'
193194
%cmake3_build
194195
195196
%install
@@ -210,6 +211,7 @@ make version.cc
210211
%{_bindir}/cstrans-df-run
211212
%{_datadir}/%{name}
212213
%{_mandir}/man1/csdiff.1*
214+
%{_mandir}/man1/csfilter-kfp.1*
213215
%{_mandir}/man1/csgrep.1*
214216
%{_mandir}/man1/cshtml.1*
215217
%{_mandir}/man1/cslinker.1*

src/CMakeLists.txt

+18-1
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,12 @@ install(TARGETS
8383
DESTINATION ${CMAKE_INSTALL_BINDIR})
8484

8585
# install the csfilter-kfp script
86+
configure_file(
87+
${CMAKE_CURRENT_SOURCE_DIR}/csfilter-kfp
88+
${CMAKE_CURRENT_BINARY_DIR}/csfilter-kfp
89+
@ONLY)
8690
install(PROGRAMS
87-
csfilter-kfp
91+
${CMAKE_CURRENT_BINARY_DIR}/csfilter-kfp
8892
DESTINATION ${CMAKE_INSTALL_BINDIR})
8993

9094
# optionally build statically linked csgrep-static
@@ -190,6 +194,19 @@ if(HELP2MAN)
190194
create_manpage(cslinker)
191195
create_manpage(cssort)
192196
create_manpage(cstrans-df-run)
197+
198+
# create/install the csfilter-kfp.1 man page
199+
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/csfilter-kfp.1"
200+
COMMAND env LC_ALL=C ${HELP2MAN} --no-info --section 1
201+
--include "${CMAKE_SOURCE_DIR}/doc/csfilter-kfp.h2m"
202+
${CMAKE_CURRENT_BINARY_DIR}/csfilter-kfp
203+
> csfilter-kfp.1 || rm -f csfilter-kfp.1
204+
COMMENT "Generating csfilter-kfp man page"
205+
VERBATIM)
206+
add_custom_target(csfilter-kfp.1 ALL DEPENDS
207+
"${CMAKE_CURRENT_BINARY_DIR}/csfilter-kfp.1")
208+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/csfilter-kfp.1
209+
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
193210
else()
194211
message(STATUS "help2man not found - documentation will NOT be built")
195212
endif()

src/csfilter-kfp

+4
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ def main():
209209
"-n", "--dry-run", action="store_true",
210210
help="do not execute anything, only print the shell script that would be executed")
211211

212+
parser.add_argument(
213+
"--version", action="version", version="@VERSION@",
214+
help="print the version string and exit")
215+
212216
# parse command-line arguments
213217
args = parser.parse_args()
214218

0 commit comments

Comments
 (0)