22 lines
607 B
Python
22 lines
607 B
Python
|
|
import sys
|
||
|
|
|
||
|
|
from . import commands
|
||
|
|
|
||
|
|
|
||
|
|
def dispatch(args) -> int:
|
||
|
|
if not args.command:
|
||
|
|
print("Error: No command specified", file=sys.stderr)
|
||
|
|
return 1
|
||
|
|
|
||
|
|
if args.command == "compile":
|
||
|
|
return commands.cmd_compile(args.source, args.output)
|
||
|
|
elif args.command == "run":
|
||
|
|
return commands.cmd_run(args.path)
|
||
|
|
elif args.command == "inspect":
|
||
|
|
return commands.cmd_inspect(args.path)
|
||
|
|
elif args.command == "summary":
|
||
|
|
return commands.cmd_summary(args.path)
|
||
|
|
else:
|
||
|
|
print(f"Error: Unknown command: {args.command}", file=sys.stderr)
|
||
|
|
return 1
|