summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorr-richmond <rrichmond.gh@gmail.com>2020-07-12 21:04:02 -0700
committerr-richmond <rrichmond.gh@gmail.com>2020-07-12 21:04:02 -0700
commite2ec04ce43e423dfc1aff88ce95b372620b9560a (patch)
tree74101cb01159d90da6036dfa2bd0ded904af356c /scripts
parent74fc0b0ce18e29c51a45534b4bc02a77571531a7 (diff)
downloadisort-e2ec04ce43e423dfc1aff88ce95b372620b9560a.tar.gz
add example cli usage
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build_config_option_docs.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/build_config_option_docs.py b/scripts/build_config_option_docs.py
index 6a094b54..54db3491 100755
--- a/scripts/build_config_option_docs.py
+++ b/scripts/build_config_option_docs.py
@@ -67,12 +67,13 @@ class Example:
.lstrip()
)
- if self.cli == "":
+ if self.cli:
cli = dedent(self.cli).lstrip()
self.cli = (
dedent(
"""
### Example cli usage
+
`{cli}`
"""
)
@@ -80,11 +81,11 @@ class Example:
.lstrip()
)
+ sections = [s for s in [self.cfg, self.pyproject_toml, self.cli] if s]
+ sections_str = "\n".join(sections)
self.section_complete = f"""**Examples:**
-{self.cfg}
-{self.pyproject_toml}
-{self.cli}"""
+{sections_str}"""
else:
self.section_complete = ""
@@ -106,6 +107,7 @@ example_mapping = {
known_airflow = ['airflow']""",
),
"multi_line_output": Example(cfg="multi_line_output=3", pyproject_toml="multi_line_output = 3"),
+ "show_version": Example(cli="isort --version"),
}