Skip to content

RFC New sman(1) script

Seth McDonald linux-man 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2src/bin/sman: Add scriptsrc/bin/sman+54 -05 replies
2/2man/man1/sman.1: Add man pageman/man1/sman.1+69 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH v1 0/2] New sman(1) script

G'day,

When parsing man pages, I've noticed I'm often only interested in a particular set of sections within the page (e.g. SYNOPSIS, HISTORY). And since skimming through the page to get to these sections can get monotonous, I wrote up a small bash script to automate the process.

As far as I can tell, no program in src/bin/ can currently do this. The closest is mansect(1), but that outputs the source code rather than the rendered page. So I've improved the script somewhat and written a brief man page for it, as included in this patch set.

The main advantage to this script as opposed to manually awk(1)ing or sed(1)ing man pages is it can preserve the bold/italic formatting in a rendered man page. It currently does so by using sed(1) to locate the section headers with regex which includes the relevant ANSI escape codes dictating bold and regular text.

I would consider this script a WIP still, and likely shouldn't yet be pushed without further edits. The purpose of this patch set is to gauge interest in and comments on this script, moreso than to be immediately applied to the repo.

As an example, the script currently re-renders the whole man page for each section in a for loop, rather than printing each section from the same rendered page, which would likely be more performant. I also named the script sman(1) primarily because I can't think of a better name.

Feel free to give your thoughts!

Seth McDonald (2):
src/bin/sman: Add script
man/man1/sman.1: Add man page

 man/man1/sman.1 | 69 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/bin/sman    | 54 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 123 insertions(+)
 create mode 100644 man/man1/sman.1
 create mode 100755 src/bin/sman

Range-diff against v0:

-:  ------------ > 1:  d093a884e5fb src/bin/sman: Add script
-:  ------------ > 2:  e1849d315c95 man/man1/sman.1: Add man page

base-commit: 6754bd1a126ed1e9b7d9c2bc1d221681f5182bb3

Signature · 1 line
2.47.3