diff options
author | Sun Howwrongbum <sun@libermatic.com> | 2022-01-01 16:32:41 +0530 |
---|---|---|
committer | Sun Howwrongbum <sun@libermatic.com> | 2022-01-01 16:32:41 +0530 |
commit | 3690950850c388373870dd973ec12e1b8412ec0f (patch) | |
tree | fa52b1b7b868e4ab0efbe1aabde46693487bfc64 /tools/gen_config_doc.py | |
parent | a30e419820ce40f209c674650477bae1947d85ec (diff) | |
download | trackermap-server-3690950850c388373870dd973ec12e1b8412ec0f.tar.gz trackermap-server-3690950850c388373870dd973ec12e1b8412ec0f.tar.bz2 trackermap-server-3690950850c388373870dd973ec12e1b8412ec0f.zip |
feat: generate config keys as pug
Diffstat (limited to 'tools/gen_config_doc.py')
-rw-r--r-- | tools/gen_config_doc.py | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/tools/gen_config_doc.py b/tools/gen_config_doc.py index caedba577..98266386e 100644 --- a/tools/gen_config_doc.py +++ b/tools/gen_config_doc.py @@ -2,7 +2,7 @@ import re import os - +import argparse _KEYS_FILE = os.path.join( os.path.dirname(__file__), "../src/main/java/org/traccar/config/Keys.java" @@ -72,6 +72,31 @@ def get_html(): ) +def get_pug(): + return ("\n").join( + [ + f""" div(class='card mt-3') + div(class='card-body') + h5(class='card-title') {x["key"]} #[span(class='badge badge-dark') config] + p(class='card-text') {"#[br] ".join(x["description"])}""" + for x in get_config_keys() + ] + ) + + if __name__ == "__main__": - html = get_html() - print(html) + parser = argparse.ArgumentParser( + description="Parses Keys.java to extract keys to be used in configuration files" + ) + parser.add_argument( + "--format", choices=["pug", "html"], default="pug", help="default: 'pug'" + ) + args = parser.parse_args() + + def get_output(): + if args.format == 'html': + return get_html() + + return get_pug() + + print(get_output())
\ No newline at end of file |