Compare commits

...

2 commits

2 changed files with 14 additions and 2 deletions

View file

@ -19,7 +19,14 @@ class Wad(dcc.config.Base):
wcp = self.pwads.joinpath(self.wad).joinpath(self.config_name) wcp = self.pwads.joinpath(self.wad).joinpath(self.config_name)
if wcp.exists(): if wcp.exists():
self._wad_config = tomlkit.toml_file.TOMLFile(wcp).read() self._wad_config = tomlkit.toml_file.TOMLFile(wcp).read()
self._config.update(self._wad_config.value) for k,v in self._wad_config.items():
if isinstance(v, dict):
if not k in self._config:
self._config[k] = {}
for sk in v:
self._config[k][sk] = v[sk]
else:
self._config[k] = v
def run(self, parsed_args): def run(self, parsed_args):
self.wad_init(parsed_args) self.wad_init(parsed_args)

View file

@ -32,6 +32,11 @@ class Text(dcc.doom_base.WadMap):
return parser return parser
def take_action(self, parsed_args): def take_action(self, parsed_args):
text = None
map_names = self._config["map_names"]
if map_names is not None:
text = map_names[f"map{parsed_args.map}"]
if text is None:
text = sys.stdin.read().rstrip() text = sys.stdin.read().rstrip()
if not parsed_args.nomap: if not parsed_args.nomap:
text = "MAP{}: {}".format(parsed_args.map, text) text = "MAP{}: {}".format(parsed_args.map, text)