PEP 8 compliance.
This commit is contained in:
parent
218928f033
commit
80070e3a5e
1 changed files with 33 additions and 21 deletions
54
dcc/ls.py
54
dcc/ls.py
|
@ -1,27 +1,39 @@
|
||||||
import dcc.config
|
import dcc.config
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class List(dcc.config.Base):
|
class List(dcc.config.Base):
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
parser.add_argument("target")
|
parser.add_argument("target")
|
||||||
parser.add_argument("--wad")
|
parser.add_argument("--wad")
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
match parsed_args.target:
|
match parsed_args.target:
|
||||||
case "pwads":
|
case "pwads":
|
||||||
self.list(x.name for x in os.scandir(self.pwads) if x.is_dir())
|
self.list(x.name for x in os.scandir(self.pwads) if x.is_dir())
|
||||||
case "iwads":
|
case "iwads":
|
||||||
self.list(x.name for x in os.scandir(self.iwads) if x.is_file())
|
self.list(
|
||||||
case "demos":
|
x.name for x in os.scandir(self.iwads)
|
||||||
self.list(x.name for x in os.scandir(self.demos.joinpath(parsed_args.wad)) if x.name.endswith(".lmp"))
|
if x.is_file()
|
||||||
case "videos":
|
)
|
||||||
self.list(x.name for x in os.scandir(self.fabricate.joinpath(parsed_args.wad)) if x.name.endswith(".mp4"))
|
case "demos":
|
||||||
case _:
|
self.list(
|
||||||
raise Exception(f"unknown target {parsed_args.target}")
|
x.name for x in
|
||||||
|
os.scandir(self.demos.joinpath(parsed_args.wad))
|
||||||
|
if x.name.endswith(".lmp")
|
||||||
|
)
|
||||||
|
case "videos":
|
||||||
|
self.list(
|
||||||
|
x.name for x in
|
||||||
|
os.scandir(self.fabricate.joinpath(parsed_args.wad))
|
||||||
|
if x.name.endswith(".mp4")
|
||||||
|
)
|
||||||
|
case _:
|
||||||
|
raise Exception(f"unknown target {parsed_args.target}")
|
||||||
|
|
||||||
def list(self, gen):
|
def list(self, gen):
|
||||||
# TODO: fancy text?
|
# TODO: fancy text?
|
||||||
for i in sorted(gen):
|
for i in sorted(gen):
|
||||||
print(i)
|
print(i)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue