summaryrefslogtreecommitdiff
path: root/hack
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2022-09-07 15:19:59 -0600
committerEd Santiago <santiago@redhat.com>2022-09-09 08:20:31 -0600
commit3a9a7dcdcd897cf694bb9935098d3c24c08d01f0 (patch)
treee2a4d86863b82dcfeb47bfb30b9b85c4192c7703 /hack
parent7e7db23dbf163837ba3216fea09b31d2c8409fb3 (diff)
downloadpodman-3a9a7dcdcd897cf694bb9935098d3c24c08d01f0.tar.gz
podman-3a9a7dcdcd897cf694bb9935098d3c24c08d01f0.tar.bz2
podman-3a9a7dcdcd897cf694bb9935098d3c24c08d01f0.zip
Man pages: refactor common options: --volume
This one is a nightmare, because --volume has been edited in four different files throughout the years (five if you count podman-build, which I am not including in this PR). Those edits have not always been done in sync. The list of options was reordered 2022-06-28 by Giuseppe in #14734, but only in podman-create and -run (not in podman-pod-*). No explanation of why, but I'll assume he knew what he was doing, and have accepted that for the reference copy. There was also a big edit in #8519. The "Propagation property...bind mounted" sentence first appeared in pod-clone, in #14299 by cdoern, with no obvious source of where it came from. I choose to include it in the reference copy. The "**copy**" option seems to work in pod-create, so I'm including it in the reference copy. Someone please yell loudly if this is not the case. The "disables SELinux separation for containers used in the build", no idea, changed that to just "for the container/pod" The "advanced users / overlay / upperdir / workdir" paragraph makes zero sense to me, but hey, I assume it applies to all the commands, so I put it in the reference copy. Finally, there's still a mishmash of backticks, asterisks, underscores, and even quotation marks. Someone is gonna have to perform major cleanup on this one day, but at least it'll be in only one place. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'hack')
-rwxr-xr-xhack/markdown-preprocess13
-rwxr-xr-xhack/markdown-preprocess.t1
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__':