mirror of
https://github.com/enzet/map-machine.git
synced 2025-04-30 18:57:49 +02:00
Fix option default value representation.
This commit is contained in:
parent
c1bc751ded
commit
1b37fa5d38
2 changed files with 18 additions and 12 deletions
|
@ -151,10 +151,10 @@ python roentgen.py render -b 2.284,48.86,2.29,48.865
|
||||||
| `-i`, `--input` | input XML file name or names (if not specified, file will be downloaded using OpenStreetMap API) |
|
| `-i`, `--input` | input XML file name or names (if not specified, file will be downloaded using OpenStreetMap API) |
|
||||||
| `-o`, `--output` | output SVG file name, default value: `out/map.svg` |
|
| `-o`, `--output` | output SVG file name, default value: `out/map.svg` |
|
||||||
| `-b`, `--boundary-box` | geo boundary box, use space before "-" if the first value is negative |
|
| `-b`, `--boundary-box` | geo boundary box, use space before "-" if the first value is negative |
|
||||||
| `-s`, `--scale` | OSM zoom level (may not be integer), default value: `18` |
|
| `-s`, `--scale` | OSM zoom level (may not be integer), default value: 18 |
|
||||||
| `--cache` | path for temporary OSM files, default value: `cache` |
|
| `--cache` | path for temporary OSM files, default value: `cache` |
|
||||||
| `--labels` | label drawing mode: `no`, `main`, or `all`, default value: `main` |
|
| `--labels` | label drawing mode: `no`, `main`, or `all`, default value: `main` |
|
||||||
| `--overlap` | how many pixels should be left around icons and text, default value: `12` |
|
| `--overlap` | how many pixels should be left around icons and text, default value: 12 |
|
||||||
| `--mode` | map drawing mode, default value: `normal` |
|
| `--mode` | map drawing mode, default value: `normal` |
|
||||||
| `--seed` | seed for random |
|
| `--seed` | seed for random |
|
||||||
| `--level` | display only this floor level |
|
| `--level` | display only this floor level |
|
||||||
|
@ -168,7 +168,7 @@ Command: `tile`.
|
||||||
|---|---|
|
|---|---|
|
||||||
| `-h`, `--help` | show this help message and exit |
|
| `-h`, `--help` | show this help message and exit |
|
||||||
| `-c`, `--coordinates` | coordinates of any location inside the tile |
|
| `-c`, `--coordinates` | coordinates of any location inside the tile |
|
||||||
| `-s`, `--scale` | OSM zoom level, default value: `18` |
|
| `-s`, `--scale` | OSM zoom level, default value: 18 |
|
||||||
| `-t`, `--tile` | tile specification |
|
| `-t`, `--tile` | tile specification |
|
||||||
| `--cache` | path for temporary OSM files, default value: `cache` |
|
| `--cache` | path for temporary OSM files, default value: `cache` |
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ from moire.default import Default, DefaultHTML, DefaultMarkdown, DefaultWiki
|
||||||
from roentgen import workspace
|
from roentgen import workspace
|
||||||
from roentgen.icon import ShapeExtractor
|
from roentgen.icon import ShapeExtractor
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, List, Any
|
from typing import Dict, List, Any, Union
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from roentgen import ui
|
from roentgen import ui
|
||||||
|
@ -19,6 +19,7 @@ __author__ = "Sergey Vartanov"
|
||||||
__email__ = "me@enzet.ru"
|
__email__ = "me@enzet.ru"
|
||||||
|
|
||||||
Arguments = List[Any]
|
Arguments = List[Any]
|
||||||
|
Code = Union[str, Tag, List]
|
||||||
|
|
||||||
PREFIX: str = "https://wiki.openstreetmap.org/wiki/"
|
PREFIX: str = "https://wiki.openstreetmap.org/wiki/"
|
||||||
|
|
||||||
|
@ -29,7 +30,7 @@ class ArgumentParser(argparse.ArgumentParser):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.arguments = []
|
self.arguments: List[Dict[str, Any]] = []
|
||||||
super(ArgumentParser, self).__init__(*args, **kwargs)
|
super(ArgumentParser, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def add_argument(self, *args, **kwargs) -> None:
|
def add_argument(self, *args, **kwargs) -> None:
|
||||||
|
@ -43,12 +44,15 @@ class ArgumentParser(argparse.ArgumentParser):
|
||||||
self.arguments.append(argument)
|
self.arguments.append(argument)
|
||||||
|
|
||||||
def get_moire_help(self) -> Tag:
|
def get_moire_help(self) -> Tag:
|
||||||
"""Return Moire table with stored arguments."""
|
"""
|
||||||
|
Return Moire table with "Option" and "Description" columns filled with
|
||||||
|
arguments.
|
||||||
|
"""
|
||||||
table = [[["Option"], ["Description"]]]
|
table = [[["Option"], ["Description"]]]
|
||||||
|
|
||||||
for option in self.arguments:
|
for option in self.arguments:
|
||||||
array = [[Tag("m", [x]), ", "] for x in option["arguments"]]
|
array: Code = [[Tag("m", [x]), ", "] for x in option["arguments"]]
|
||||||
row = [[x for y in array for x in y][:-1]]
|
row: Code = [[x for y in array for x in y][:-1]]
|
||||||
|
|
||||||
if "help" in option:
|
if "help" in option:
|
||||||
help_value: List = [option["help"]]
|
help_value: List = [option["help"]]
|
||||||
|
@ -57,14 +61,16 @@ class ArgumentParser(argparse.ArgumentParser):
|
||||||
and option["default"]
|
and option["default"]
|
||||||
and option["default"] != "==SUPPRESS=="
|
and option["default"] != "==SUPPRESS=="
|
||||||
):
|
):
|
||||||
help_value += [
|
default_value: Code = Tag("m", [str(option["default"])])
|
||||||
", default value: ",
|
if "type" in option and option["type"] in [int, float]:
|
||||||
Tag("m", [str(option["default"])]),
|
default_value = str(option["default"])
|
||||||
]
|
help_value += [", default value: ", default_value]
|
||||||
row.append(help_value)
|
row.append(help_value)
|
||||||
else:
|
else:
|
||||||
row.append([])
|
row.append([])
|
||||||
|
|
||||||
table.append(row)
|
table.append(row)
|
||||||
|
|
||||||
return Tag("table", table)
|
return Tag("table", table)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue