Have configure inherit from doom_base.Wad so that it knows about wad-level parameters.
This commit is contained in:
parent
105be2c5fd
commit
b56b0419e2
1 changed files with 5 additions and 7 deletions
|
@ -1,12 +1,10 @@
|
|||
import dcc.config
|
||||
import tomlkit
|
||||
from tomlkit.toml_file import TOMLFile
|
||||
import dcc.doom_base
|
||||
import tomlkit.toml_file
|
||||
|
||||
|
||||
class Configure(dcc.config.Base):
|
||||
class Configure(dcc.doom_base.Wad):
|
||||
def get_parser(self, prog_name):
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument("wad")
|
||||
parser.add_argument("complevel")
|
||||
parser.add_argument("--iwad")
|
||||
return parser
|
||||
|
@ -14,12 +12,12 @@ class Configure(dcc.config.Base):
|
|||
def take_action(self, parsed_args):
|
||||
new_config = self.pwad_path.joinpath(self.config_name)
|
||||
if new_config.exists():
|
||||
raise Exception("Config %s already exists.".format(new_config))
|
||||
raise Exception(f"Config {new_config} already exists.")
|
||||
|
||||
doc = tomlkit.document()
|
||||
doc.add("complevel", parsed_args.complevel)
|
||||
if parsed_args.iwad is not None:
|
||||
doc.add("iwad", parsed_args.iwad)
|
||||
|
||||
f = TOMLFile(new_config)
|
||||
f = tomlkit.toml_file.TOMLFile(new_config)
|
||||
f.write(doc)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue