File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1515 - user-guide/getting-started.md
1616 - user-guide/stagyydata.md
1717 - user-guide/cli.md
18+ - user-guide/config-opts.md
1819 - Cookbook :
1920 - cookbook/time.md
2021 - cookbook/rprof.md
@@ -36,6 +37,7 @@ plugins:
3637 - gen-files :
3738 scripts :
3839 - scripts/gen_ref_pages.py
40+ - scripts/gen_conf_list.py
3941 - literate-nav :
4042 nav_file : SUMMARY.md
4143 - mkdocstrings :
Original file line number Diff line number Diff line change 1+ """Generate list of configuration options."""
2+
3+ from dataclasses import fields
4+ from pathlib import Path
5+ from typing import TextIO
6+
7+ import mkdocs_gen_files
8+
9+
10+ def print_config_list (fd : TextIO ) -> None :
11+ from stagpy .config import Config
12+
13+ stagpy_conf = Config .default_ ()
14+ for sec_fld in fields (stagpy_conf ):
15+ sec_name = sec_fld .name
16+ print (file = fd )
17+ print (f"## { sec_name } " , file = fd )
18+ print (file = fd )
19+ print ("Name | Description | CLI, config file?" , file = fd )
20+ print ("---|---|---" , file = fd )
21+ section = getattr (stagpy_conf , sec_name )
22+ for fld in fields (section ):
23+ opt = fld .name
24+ entry = section .meta_ (opt ).entry
25+ if entry .in_cli and entry .in_file :
26+ c_f = "both"
27+ elif entry .in_cli :
28+ c_f = "CLI"
29+ else :
30+ c_f = "config file"
31+ sec_class = section .__class__ .__name__
32+ ident = f"stagpy.config.{ sec_class } .{ opt } "
33+ print (f"[{ opt } ][{ ident } ] | { entry .doc } | { c_f } " , file = fd )
34+
35+
36+ full_doc_path = Path ("user-guide" ) / "config-opts.md"
37+
38+ with mkdocs_gen_files .open (full_doc_path , "w" ) as fd :
39+ print ("List of configuration options" , file = fd )
40+ print ("===" , file = fd )
41+ print_config_list (fd )
You can’t perform that action at this time.
0 commit comments