mirror of https://github.com/docker/compose.git
Merge pull request #7725 from ulyssessouza/update-docs-add-check-script
Add docker.github.io documentation checker and update doc message
This commit is contained in:
commit
c030596db5
|
@ -310,14 +310,14 @@ class TopLevelCommand:
|
|||
|
||||
Options:
|
||||
--resolve-image-digests Pin image tags to digests.
|
||||
--no-interpolate Don't interpolate environment variables
|
||||
--no-interpolate Don't interpolate environment variables.
|
||||
-q, --quiet Only validate the configuration, don't print
|
||||
anything.
|
||||
--services Print the service names, one per line.
|
||||
--volumes Print the volume names, one per line.
|
||||
--hash="*" Print the service config hash, one per line.
|
||||
Set "service1,service2" for a list of specified services
|
||||
or use the wildcard symbol to display all services
|
||||
or use the wildcard symbol to display all services.
|
||||
"""
|
||||
|
||||
additional_options = {'--no-interpolate': options.get('--no-interpolate')}
|
||||
|
@ -1005,7 +1005,7 @@ class TopLevelCommand:
|
|||
--build Build images before starting containers.
|
||||
--abort-on-container-exit Stops all containers if any container was
|
||||
stopped. Incompatible with -d.
|
||||
--attach-dependencies Attach to dependent containers
|
||||
--attach-dependencies Attach to dependent containers.
|
||||
-t, --timeout TIMEOUT Use this timeout in seconds for container
|
||||
shutdown when attached or when containers are
|
||||
already running. (default: 10)
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env python3
|
||||
import glob
|
||||
import os.path
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
USAGE_RE = re.compile(r"```.*?\nUsage:.*?```", re.MULTILINE | re.DOTALL)
|
||||
USAGE_IN_CMD_RE = re.compile(r"^Usage:.*", re.MULTILINE | re.DOTALL)
|
||||
|
||||
HELP_CMD = "docker run --rm docker/compose:latest %s --help"
|
||||
|
||||
for file in glob.glob("compose/reference/*.md"):
|
||||
with open(file) as f:
|
||||
data = f.read()
|
||||
if not USAGE_RE.search(data):
|
||||
print("Not a command:", file)
|
||||
continue
|
||||
subcmd = os.path.basename(file).replace(".md", "")
|
||||
if subcmd == "overview":
|
||||
continue
|
||||
print(f"Found {subcmd}: {file}")
|
||||
help_cmd = HELP_CMD % subcmd
|
||||
help = subprocess.check_output(help_cmd.split())
|
||||
help = help.decode("utf-8")
|
||||
help = USAGE_IN_CMD_RE.findall(help)[0]
|
||||
help = help.strip()
|
||||
data = USAGE_RE.sub(f"```none\n{help}\n```", data)
|
||||
with open(file, "w") as f:
|
||||
f.write(data)
|
Loading…
Reference in New Issue