Read values out of a config file instead of hardcoding them. Further streamline common tasks in a new base config class.
This commit is contained in:
parent
606f27185c
commit
057ac98843
11 changed files with 83 additions and 69 deletions
|
@ -1,4 +1,3 @@
|
|||
from cliff.command import Command
|
||||
import dcc.config
|
||||
import io
|
||||
import json
|
||||
|
@ -6,7 +5,7 @@ import pathlib
|
|||
import urllib.request
|
||||
import zipfile
|
||||
|
||||
class Fetch(Command):
|
||||
class Fetch(dcc.config.Base):
|
||||
def get_parser(self, prog_name):
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument("id_or_name")
|
||||
|
@ -24,7 +23,7 @@ class Fetch(Command):
|
|||
|
||||
with urllib.request.urlopen(rpath) as response:
|
||||
z = zipfile.ZipFile(io.BytesIO(response.read()))
|
||||
z.extractall(path=dcc.config.PwadPath(wad))
|
||||
z.extractall(path=self.pwads.joinpath(wad))
|
||||
|
||||
# TODO: explicit error handling. Let users choose when >1 result.
|
||||
def search_idgames(self, wad):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue