Skip to content

Commit bfeea50

Browse files
committed
csfilter-kfp: install a simple man page
... generated from the output of `--help`
1 parent ec2c96b commit bfeea50

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

doc/csfilter-kfp.h2m

Lines changed: 2 additions & 0 deletions
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 18 additions & 1 deletion
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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ def main():
201201
"-n", "--dry-run", action="store_true",
202202
help="do not execute anything, only print the shell script that would be executed")
203203

204+
parser.add_argument(
205+
"--version", action="version", version="@VERSION@",
206+
help="show the version number and exit")
207+
204208
# parse command-line arguments
205209
args = parser.parse_args()
206210

0 commit comments

Comments
 (0)