Skip to content

Commit

Permalink
Run mandoc or groff instead of man.REAL to check man page
Browse files Browse the repository at this point in the history
Also fix all warnings reported by mandoc and apply some of the recommendations
from https://liw.fi/manpages/.
  • Loading branch information
erijo committed Dec 10, 2024
1 parent 24772e7 commit 216d49c
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 100 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ man-ps:
@groff -man -Tps ./yadm.1 > yadm.ps

yadm.md: yadm.1
@groff -man -Tutf8 -Z ./yadm.1 | grotty -c | col -bx | sed 's/^[A-Z]/## &/g' | sed '/yadm(1)/d' > yadm.md
@groff -man -Tutf8 -Z ./yadm.1 | grotty -c | col -bx | sed 's/^[A-Z]/## &/g' | sed '/YADM(1)/d' > yadm.md

.PHONY: contrib
contrib: SHELL = /bin/bash
Expand Down
9 changes: 7 additions & 2 deletions test/test_syntax.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Syntax checks"""

import os
import shutil

import pytest

Expand Down Expand Up @@ -77,7 +78,11 @@ def test_yamllint(pytestconfig, runner, yamllint_version):

def test_man(runner):
"""Check for warnings from man"""
run = runner(command=["man.REAL", "--warnings", "./yadm.1"])
if shutil.which("mandoc"):
command = ["mandoc", "-T", "lint"]
else:
command = ["groff", "-ww", "-z"]
run = runner(command=command + ["-man", "./yadm.1"])
assert run.success
assert run.out == ""
assert run.err == ""
assert "yadm - Yet Another Dotfiles Manager" in run.out
Loading

0 comments on commit 216d49c

Please sign in to comment.