feat: improves and initilize player pipeline
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from diceplayer.cli import ArgsModel, read_input
|
||||
from diceplayer.config import PlayerConfig
|
||||
from diceplayer.logger import logger
|
||||
from diceplayer.player import Player
|
||||
|
||||
@@ -33,13 +34,26 @@ def main():
|
||||
metavar="OUTFILE",
|
||||
help="output file of diceplayer [default = run.log]",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-f",
|
||||
"--force",
|
||||
dest="force",
|
||||
default=False,
|
||||
action="store_true",
|
||||
help="force overwrite existing state file if it exists [default = False]",
|
||||
)
|
||||
args = ArgsModel.from_args(parser.parse_args())
|
||||
|
||||
logger.set_output_file(args.outfile)
|
||||
|
||||
config = read_input(args.infile)
|
||||
config: PlayerConfig
|
||||
try:
|
||||
config = read_input(args.infile)
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to read input file: {e}")
|
||||
return
|
||||
|
||||
Player(config).play(continuation=args.continuation)
|
||||
Player(config).play(continuation=args.continuation, force=args.force)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user