From 281c0d47d2b8b4717d68eb8a80850ed3016fe288 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 23 May 2021 06:35:04 +0200 Subject: [PATCH] Add basic man page. --- CMakeLists.txt | 2 ++ README.adoc | 6 ++++ man/CMakeLists.txt | 13 ++++++++ man/build_manpage.sh | 13 ++++++++ man/epubgrep.1.adoc | 79 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 113 insertions(+) create mode 100644 man/CMakeLists.txt create mode 100755 man/build_manpage.sh create mode 100644 man/epubgrep.1.adoc diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f65df2..1ab933c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,3 +34,5 @@ if(WITH_TESTS) endif() add_subdirectory(translations) + +add_subdirectory(man) diff --git a/README.adoc b/README.adoc index b2022b3..41e2764 100644 --- a/README.adoc +++ b/README.adoc @@ -13,9 +13,14 @@ :uri-gettext: https://www.gnu.org/software/gettext/ :uri-libarchive: https://www.libarchive.org/ :uri-fmt: https://github.com/fmtlib/fmt +:uri-asciidoc: http://asciidoc.org/ *{project}* is a search tool for EPUB ebooks. +== Usage + +See https://schlomp.space/tastytea/{project}/src/branch/main/man/{project}.1.adoc[manpage]. + == Install [alt="Packaging status" link=https://repology.org/project/epubgrep/versions] @@ -43,6 +48,7 @@ image::https://repology.org/badge/vertical-allrepos/epubgrep.svg[] * link:{uri-gettext}[gettext] (tested: 0.21 / 0.19) * link:{uri-libarchive}[libarchive] (tested: 3.5 / 3.2) * link:{uri-fmt}[fmt] (tested: 7.0 / 4.0) +* link{uri-asciidoc}[AsciiDoc] (tested: 8.6 / 9.0) * Optional ** Tests: link:{uri-catch}[Catch] (tested: 2.13 / 1.10) diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt new file mode 100644 index 0000000..fdd941b --- /dev/null +++ b/man/CMakeLists.txt @@ -0,0 +1,13 @@ +include(GNUInstallDirs) + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + DEPENDS "${PROJECT_NAME}.1.adoc" + COMMAND "${PROJECT_SOURCE_DIR}/man/build_manpage.sh" + ARGS "${PROJECT_VERSION}") + +add_custom_target(man ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1") + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1 + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) diff --git a/man/build_manpage.sh b/man/build_manpage.sh new file mode 100755 index 0000000..e3fa261 --- /dev/null +++ b/man/build_manpage.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +name="epubgrep" + +if [ -n "${1}" ]; then + dir=$(dirname "${0}") + version=${1} + cp -vf "${dir}/${name}.1.adoc" . + sed -Ei "s/(Revision: +)[0-9]+\.[0-9]\.[0-9]/\1${version}/" "${name}.1.adoc" + a2x --doctype manpage --format manpage --no-xmllint "${name}.1.adoc" +else + echo "usage: ${0} VERSION" >&2 +fi diff --git a/man/epubgrep.1.adoc b/man/epubgrep.1.adoc new file mode 100644 index 0000000..0672952 --- /dev/null +++ b/man/epubgrep.1.adoc @@ -0,0 +1,79 @@ += epubgrep(1) +:doctype: manpage +:Author: tastytea +:Email: tastytea@tastytea.de +:Date: 2021-05-23 +:Revision: 0.0.0 +:man source: epubgrep +:man manual: General Commands Manual + +== NAME + +epubgrep - Search tool for EPUB ebooks. + +== SYNOPSIS + +*epubgrep* [_OPTION_]… _PATTERN_ [_FILE_]… + +== DESCRIPTION + +*epubgrep* searches EPUB files in a similar way as grep. It uses the same names +for command line switches. + +== OPTIONS + +*-h*, *--help*:: +Display a short help message and exit. + +*V*, *--version*:: +Show version, copyright and license. + +*-E*, *--extended-regexp*:: +_PATTERN_ is extended regular expression. + +*-P*, *--perl-regexp*:: +_PATTERN_ is Perl regular expression. + +*-i*, *--ignore-case*:: +Ignore case distinctions in pattern and data. + +*-e* _PATTERN_, *--regexp* _PATTERN_:: +Use _PATTERN_ for matching. + +*-I* _FILE_, *--input-file* _FILE_:: +Input file. Can be used more than once. + +// == USAGE + +// === Configuration + +// == EXAMPLES + +== FILES + +*Configuration file*:: +* If `XDG_CONFIG_HOME` is defined: `${XDG_CONFIG_HOME}/epubgrep.conf` +* If `HOME` is defined: `${HOME}/.config/epubgrep.conf` +* Otherwise: `epubgrep.conf` + + +== KNOWN BUGS + +EPUB files with non-ASCII file names only work reliably when the system locale +uses an encoding which has the necessary characters. Technically EPUBs must use +UTF-8 for file names but it is usually recommended to only use ASCII (ASCII is +valid UTF-8). If your system locale is not UTF-8, files may be silently skipped. +You can work around this by calling epubgrep like this: +`LC_ALL="C.UTF-8" epubgrep` + +== REPORTING BUGS + +Bugtracker: https://schlomp.space/tastytea/epubgrep/issues + +E-mail: tastytea@tastytea.de + +== SEE ALSO + +*perlre*(1) + +// LocalWords: epubgrep