mirror of
https://github.com/containers/podman.git
synced 2025-07-10 07:34:26 +08:00
Merge pull request #15331 from edsantiago/docs_dedup_piecemeal
Man pages: refactor common options: arch
This commit is contained in:
docs/source/markdown
hack
@ -42,3 +42,5 @@ This allows the shared use of examples in the option file:
|
|||||||
```
|
```
|
||||||
Example: podman <<subcommand>> --foo --bar
|
Example: podman <<subcommand>> --foo --bar
|
||||||
```
|
```
|
||||||
|
As a special case, `podman-pod-X` becomes just `X` (the "pod" is removed).
|
||||||
|
This makes the `pod-id-file` man page more useful.
|
||||||
|
2
docs/source/markdown/options/arch.md
Normal file
2
docs/source/markdown/options/arch.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#### **--arch**=*ARCH*
|
||||||
|
Override the architecture, defaults to hosts, of the image to be pulled. For example, `arm`.
|
@ -73,8 +73,7 @@ and specified with a _tag_.
|
|||||||
Add an annotation to the container. The format is key=value.
|
Add an annotation to the container. The format is key=value.
|
||||||
The **--annotation** option can be set multiple times.
|
The **--annotation** option can be set multiple times.
|
||||||
|
|
||||||
#### **--arch**=*ARCH*
|
@@option arch
|
||||||
Override the architecture, defaults to hosts, of the image to be pulled. For example, `arm`.
|
|
||||||
|
|
||||||
#### **--attach**, **-a**=*location*
|
#### **--attach**, **-a**=*location*
|
||||||
|
|
||||||
|
@ -49,8 +49,7 @@ All tagged images in the repository will be pulled.
|
|||||||
|
|
||||||
*IMPORTANT: When using the all-tags flag, Podman will not iterate over the search registries in the **[containers-registries.conf(5)](https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md)** but will always use docker.io for unqualified image names.*
|
*IMPORTANT: When using the all-tags flag, Podman will not iterate over the search registries in the **[containers-registries.conf(5)](https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md)** but will always use docker.io for unqualified image names.*
|
||||||
|
|
||||||
#### **--arch**=*ARCH*
|
@@option arch
|
||||||
Override the architecture, defaults to hosts, of the image to be pulled. For example, `arm`.
|
|
||||||
|
|
||||||
#### **--authfile**=*path*
|
#### **--authfile**=*path*
|
||||||
|
|
||||||
|
@ -90,8 +90,7 @@ and specified with a _tag_.
|
|||||||
Add an annotation to the container.
|
Add an annotation to the container.
|
||||||
This option can be set multiple times.
|
This option can be set multiple times.
|
||||||
|
|
||||||
#### **--arch**=*ARCH*
|
@@option arch
|
||||||
Override the architecture, defaults to hosts, of the image to be pulled. For example, `arm`.
|
|
||||||
|
|
||||||
#### **--attach**, **-a**=*stdin* | *stdout* | *stderr*
|
#### **--attach**, **-a**=*stdin* | *stdout* | *stderr*
|
||||||
|
|
||||||
|
@ -68,6 +68,9 @@ def process(infile):
|
|||||||
|
|
||||||
# Given a file path of the form podman-foo-bar.1.md.in, return "foo bar"
|
# 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) -> str:
|
||||||
|
# Special case: 'podman-pod-start' becomes just 'start'
|
||||||
|
if string.startswith("podman-pod-"):
|
||||||
|
string = string[len("podman-pod-"):]
|
||||||
if string.startswith("podman-"):
|
if string.startswith("podman-"):
|
||||||
string = string[len("podman-"):]
|
string = string[len("podman-"):]
|
||||||
if string.endswith(".1.md.in"):
|
if string.endswith(".1.md.in"):
|
||||||
@ -89,8 +92,8 @@ def replace_type(line: str, type: str) -> str:
|
|||||||
# conceivably be present in both sides. And we check for 'pod',
|
# conceivably be present in both sides. And we check for 'pod',
|
||||||
# not 'container', because it's possible to have something like
|
# not 'container', because it's possible to have something like
|
||||||
# <<container in pod|container>>.
|
# <<container in pod|container>>.
|
||||||
if re.match('pod([^m]|$)', lhs, re.IGNORECASE):
|
if re.match('.*pod([^m]|$)', lhs, re.IGNORECASE):
|
||||||
if re.match('pod([^m]|$)', rhs, re.IGNORECASE):
|
if re.match('.*pod([^m]|$)', rhs, re.IGNORECASE):
|
||||||
raise Exception("'%s' matches 'pod' in both left and right sides" % matchobj[0])
|
raise Exception("'%s' matches 'pod' in both left and right sides" % matchobj[0])
|
||||||
# Only left-hand side has "pod"
|
# Only left-hand side has "pod"
|
||||||
if type == 'pod':
|
if type == 'pod':
|
||||||
@ -98,14 +101,14 @@ def replace_type(line: str, type: str) -> str:
|
|||||||
else:
|
else:
|
||||||
return rhs
|
return rhs
|
||||||
else:
|
else:
|
||||||
if not re.match('pod([^m]|$)', rhs, re.IGNORECASE):
|
if not re.match('.*pod([^m]|$)', rhs, re.IGNORECASE):
|
||||||
raise Exception("'%s' does not match 'pod' in either side" % matchobj[0])
|
raise Exception("'%s' does not match 'pod' in either side" % matchobj[0])
|
||||||
if type == 'pod':
|
if type == 'pod':
|
||||||
return rhs
|
return rhs
|
||||||
else:
|
else:
|
||||||
return lhs
|
return lhs
|
||||||
|
|
||||||
return re.sub('<<[^\|>]+\|[^\|>]+>>', replwith, line)
|
return re.sub('<<[^\|>]*\|[^\|>]*>>', replwith, line)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -37,6 +37,24 @@ class TestPodReplacer(unittest.TestCase):
|
|||||||
"""we ignore 'podman'"""
|
"""we ignore 'podman'"""
|
||||||
self.assertEqual(mp.replace_type('<<podman container|pod in podman>>', 'container'), 'podman container')
|
self.assertEqual(mp.replace_type('<<podman container|pod in podman>>', 'container'), 'podman container')
|
||||||
|
|
||||||
|
def test_not_at_beginning(self):
|
||||||
|
"""oops - test for 'pod' other than at beginning of string"""
|
||||||
|
s = '<<container|container or pod>>'
|
||||||
|
self.assertEqual(mp.replace_type(s, 'container'), 'container')
|
||||||
|
self.assertEqual(mp.replace_type(s, 'pod'), 'container or pod')
|
||||||
|
s = '<<container or pod|container>>'
|
||||||
|
self.assertEqual(mp.replace_type(s, 'container'), 'container')
|
||||||
|
self.assertEqual(mp.replace_type(s, 'pod'), 'container or pod')
|
||||||
|
|
||||||
|
def test_blank(self):
|
||||||
|
"""test that either side of '|' can be empty"""
|
||||||
|
s = 'abc container<<| or pod>> def'
|
||||||
|
self.assertEqual(mp.replace_type(s, 'container'), 'abc container def')
|
||||||
|
self.assertEqual(mp.replace_type(s, 'pod'), 'abc container or pod def')
|
||||||
|
s = 'abc container<< or pod|>> def'
|
||||||
|
self.assertEqual(mp.replace_type(s, 'container'), 'abc container def')
|
||||||
|
self.assertEqual(mp.replace_type(s, 'pod'), 'abc container or pod def')
|
||||||
|
|
||||||
def test_exception_both(self):
|
def test_exception_both(self):
|
||||||
"""test that 'pod' on both sides raises exception"""
|
"""test that 'pod' on both sides raises exception"""
|
||||||
with self.assertRaisesRegex(Exception, "in both left and right sides"):
|
with self.assertRaisesRegex(Exception, "in both left and right sides"):
|
||||||
@ -52,6 +70,7 @@ class TestPodmanSubcommand(unittest.TestCase):
|
|||||||
"""podman subcommand basic test"""
|
"""podman subcommand basic test"""
|
||||||
self.assertEqual(mp.podman_subcommand("podman-foo.1.md.in"), "foo")
|
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-foo-bar.1.md.in"), "foo bar")
|
||||||
|
self.assertEqual(mp.podman_subcommand("podman-pod-rm.1.md.in"), "rm")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Reference in New Issue
Block a user