summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorTimothy Crosley <timothy.crosley@gmail.com>2020-07-08 00:35:10 -0700
committerTimothy Crosley <timothy.crosley@gmail.com>2020-07-08 00:35:10 -0700
commite00418befcd170d1040daec42f82cbcfb0418ce5 (patch)
tree68d1b4008b223df1221c994a9f127f82c390cbda /scripts
parent07a4d82b357afb462c7d51531439cddb22278fb0 (diff)
downloadisort-e00418befcd170d1040daec42f82cbcfb0418ce5.tar.gz
Only show examples if present in docs, at least until examples are more prelevant
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build_config_option_docs.py17
1 files changed, 3 insertions, 14 deletions
diff --git a/scripts/build_config_option_docs.py b/scripts/build_config_option_docs.py
index 927c858b..d7b0c643 100755
--- a/scripts/build_config_option_docs.py
+++ b/scripts/build_config_option_docs.py
@@ -17,8 +17,6 @@ IGNORED = {"source", "help"}
COLUMNS = ["Name", "Type", "Default", "Python / Config file", "CLI", "Description"]
HEADER = """# Configuration options for isort
-========
-
As a code formatter isort has opinions. However, it also allows you to have your own. If your opinions disagree with those of isort,
isort will disagree but commit to your way of formatting. To enable this, isort exposes a plethora of options to specify
how you want your imports sorted, organized, and formatted.
@@ -42,12 +40,8 @@ class ConfigOption:
example_cli: str = ""
def __post_init__(self):
- if self.example_cfg == "" and self.example_pyproject_toml == "" and self.example_cli == "":
- self.example_section = "**No Examples**"
- else:
- if self.example_cfg == "":
- self.example_cfg = "No example `.isort.cfg`"
- else:
+ if self.example_cfg or self.example_pyproject_toml or self.example_cli:
+ if self.example_cfg:
self.example_cfg = textwrap.dedent(
f"""
### Example `.isort.cfg`
@@ -58,9 +52,7 @@ class ConfigOption:
"""
)
- if self.example_pyproject_toml == "":
- self.example_pyproject_toml = "No example pyproject.toml"
- else:
+ if self.example_pyproject_toml:
self.example_pyproject_toml = textwrap.dedent(
f"""
### Example `pyproject.toml`
@@ -70,11 +62,8 @@ class ConfigOption:
```
"""
)
- print(self.example_pyproject_toml)
if self.example_cli == "":
- self.example_cli = "No example cli usage"
- else:
self.example_cli = textwrap.dedent(
f"""
### Example cli usage