diff options
Diffstat (limited to 'hack')
-rwxr-xr-x | hack/markdown-preprocess | 13 | ||||
-rwxr-xr-x | hack/markdown-preprocess.t | 1 |
2 files changed, 7 insertions, 7 deletions
diff --git a/hack/markdown-preprocess b/hack/markdown-preprocess index 68e5890d8..9cd1e9605 100755 --- a/hack/markdown-preprocess +++ b/hack/markdown-preprocess @@ -32,9 +32,6 @@ def process(infile): if '-pod-' in infile or '-kube-' in infile: pod_or_container = 'pod' - # Sometimes a man page includes the subcommand. - subcommand = podman_subcommand(infile) - # foo.md.in -> foo.md -- but always write to a tmpfile outfile = os.path.splitext(infile)[0] outfile_tmp = outfile + '.tmp.' + str(os.getpid()) @@ -57,7 +54,8 @@ def process(infile): with open(optionfile, 'r') as fh_optfile: for opt_line in fh_optfile: opt_line = replace_type(opt_line, pod_or_container) - opt_line = opt_line.replace('<<subcommand>>', subcommand) + opt_line = opt_line.replace('<<subcommand>>', podman_subcommand(infile)) + opt_line = opt_line.replace('<<fullsubcommand>>', podman_subcommand(infile, 'full')) fh_out.write(opt_line) fh_out.write("\n[//]: # (END included file " + optionfile + ")\n") else: @@ -67,10 +65,11 @@ def process(infile): os.rename(outfile_tmp, outfile) # Given a file path of the form podman-foo-bar.1.md.in, return "foo bar" -def podman_subcommand(string: str) -> str: +def podman_subcommand(string: str, full=None) -> str: # Special case: 'podman-pod-start' becomes just 'start' - if string.startswith("podman-pod-"): - string = string[len("podman-pod-"):] + if not full: + if string.startswith("podman-pod-"): + string = string[len("podman-pod-"):] if string.startswith("podman-"): string = string[len("podman-"):] if string.endswith(".1.md.in"): diff --git a/hack/markdown-preprocess.t b/hack/markdown-preprocess.t index 3cc983999..152da087b 100755 --- a/hack/markdown-preprocess.t +++ b/hack/markdown-preprocess.t @@ -71,6 +71,7 @@ class TestPodmanSubcommand(unittest.TestCase): self.assertEqual(mp.podman_subcommand("podman-foo.1.md.in"), "foo") self.assertEqual(mp.podman_subcommand("podman-foo-bar.1.md.in"), "foo bar") self.assertEqual(mp.podman_subcommand("podman-pod-rm.1.md.in"), "rm") + self.assertEqual(mp.podman_subcommand("podman-pod-rm.1.md.in", "full"), "pod rm") if __name__ == '__main__': |