Add module for listing inputs and outputs for demos.
This commit is contained in:
parent
7f397f352f
commit
9570d11cdc
2 changed files with 27 additions and 0 deletions
26
dcc/ls.py
Normal file
26
dcc/ls.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
import cliff.command
|
||||
import dcc.config
|
||||
import os
|
||||
|
||||
class List(cliff.command.Command):
|
||||
def get_parser(self, prog_name):
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument("target")
|
||||
parser.add_argument("--wad")
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
match parsed_args.target:
|
||||
case "pwads":
|
||||
self.list(x.name for x in os.scandir(dcc.config.PWADS) if x.is_dir())
|
||||
case "iwads":
|
||||
self.list(x.name for x in os.scandir(dcc.config.IWADS) if x.is_file())
|
||||
case "demos":
|
||||
self.list(x.name for x in os.scandir(dcc.config.DEMOS.joinpath(parsed_args.wad)) if x.name.endswith(".lmp"))
|
||||
case "videos":
|
||||
self.list(x.name for x in os.scandir(dcc.config.OUTPUT.joinpath(parsed_args.wad)) if x.name.endswith(".mp4"))
|
||||
|
||||
def list(self, gen):
|
||||
# TODO: fancy text?
|
||||
for i in sorted(gen):
|
||||
print(i)
|
1
setup.py
1
setup.py
|
@ -34,6 +34,7 @@ setup(
|
|||
'thumb = dcc.thumb:Thumb',
|
||||
'dsda = dcc.dsda:DSDA',
|
||||
'eureka = dcc.eureka:Eureka',
|
||||
'ls = dcc.ls:List',
|
||||
],
|
||||
},
|
||||
zip_safe=False,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue