fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

r-vdpcreate_manpage_completions: handle groff \X'...' device control escapes7bd37dfe5

master
1.3 KiB38 linesraw
1#RUN: %fish %s
2#REQUIRES: command -v python3
3
4# Regression test for groff \X'...' device control escapes in man pages.
5# help2man 1.50+ emits \X'tty: link URL' hyperlinks which broke the parser.
6# See: coreutils 9.10 man pages.
7
8set -l script (status dirname)/../../share/tools/create_manpage_completions.py
9set -l tmpdir (mktemp -d)
10
11# Minimal man page with \X'tty: link' escapes as produced by help2man 1.50
12printf '%s\n' \
13    '.TH TESTCMD "1" "March 2026" "test 1.0" "User Commands"' \
14    '.SH NAME' \
15    'testcmd \\- test command' \
16    '.SH DESCRIPTION' \
17    'A test command.' \
18    '.TP' \
19    '\\X'"'"'tty: link https://example.com/a'"'"'\\fB\\-a, \\-\\-all\\fP\\X'"'"'tty: link'"'"'' \
20    'show all entries' \
21    '.TP' \
22    '\\X'"'"'tty: link https://example.com/v'"'"'\\fB\\-v, \\-\\-verbose\\fP\\X'"'"'tty: link'"'"'' \
23    'be verbose' \
24    '.TP' \
25    '\\X'"'"'tty: link https://example.com/h'"'"'\\fB\\-\\-help\\fP\\X'"'"'tty: link'"'"'' \
26    'display help' \
27    '.PP' \
28    'Some trailing paragraph text.' \
29    '.SH AUTHOR' \
30    'Nobody.' \
31    > $tmpdir/testcmd.1
32
33python3 $script --stdout $tmpdir/testcmd.1 | string match -r '^complete.*'
34#CHECK: complete -c testcmd -s a -l all -d 'show all entries'
35#CHECK: complete -c testcmd -s v -l verbose -d 'be verbose'
36#CHECK: complete -c testcmd -l help -d 'display help'
37
38rm -rf $tmpdir