Skip to content

Commit 6c92801

Browse files
docs: generate individual command man pages during build
Add build rules to dynamically generate man pages for each grcli command by invoking 'grcli --man <command>'. The list of commands is hardcoded in meson.build since meson cannot execute the compiled binary during the configuration phase. Update packaging files (under debian and rpm) to include all generated grcli man pages. Assisted-by: Cursor/Claude-4-Sonnet Signed-off-by: Abhiram R N <[email protected]>
1 parent a035076 commit 6c92801

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

debian/grout.install

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
/usr/lib/systemd/system/grout.service
66
/usr/share/bash-completion/completions/grcli
77
/usr/share/bash-completion/completions/grout
8-
/usr/share/man/man1/grcli.1
8+
/usr/share/man/man1/grcli*.1
99
/usr/share/man/man8/grout.8

docs/meson.build

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,31 @@ custom_target(
6868
install_tag: 'man',
6969
)
7070

71+
# Individual command man pages
72+
# The list is hardcoded since we can't run grcli during meson configuration.
73+
grcli_commands = [
74+
'address', 'affinity', 'conntrack', 'dnat44', 'events',
75+
'graph', 'interface', 'logging', 'nexthop', 'ping',
76+
'quit', 'route', 'router-advert', 'snat44', 'stats',
77+
'trace', 'traceroute', 'tunsrc',
78+
]
79+
80+
foreach cmd : grcli_commands
81+
cmd_md = custom_target(
82+
'grcli-@[email protected]'.format(cmd),
83+
output: 'grcli-@[email protected]'.format(cmd),
84+
command: [grcli_exe, '--man', cmd],
85+
capture: true,
86+
)
87+
custom_target(
88+
'grcli-@[email protected]'.format(cmd),
89+
input: cmd_md,
90+
output: 'grcli-@[email protected]'.format(cmd),
91+
command: md2man,
92+
install: true,
93+
feed: true,
94+
capture: true,
95+
install_dir: '@0@/man1'.format(mandir),
96+
install_tag: 'man',
97+
)
98+
endforeach

rpm/grout.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ install -D -m 0644 -t %{buildroot}%{_datadir}/dpdk/telemetry-endpoints subprojec
100100
%attr(644, root, root) %{_datadir}/bash-completion/completions/grcli
101101
%attr(755, root, root) %{_bindir}/grcli
102102
%attr(755, root, root) %{_bindir}/grout
103-
%attr(644, root, root) %{_mandir}/man1/grcli.1*
103+
%attr(644, root, root) %{_mandir}/man1/grcli*.1*
104104
%attr(644, root, root) %{_mandir}/man8/grout.8*
105105

106106
%files devel

0 commit comments

Comments
 (0)