Ryujinx-Mako/ryujinx_mako/__main__.py
TSRBerry 66a1029bd5
Refactor Mako actions, fix setup-git command & add exec-ryujinx-tasks command (#3)
* Create multiple actions to make Mako easier to use

* Add smoke tests for the new actions

* Check if the required env vars aren't empty

* Fix working directory for execute-command

* Fix action_path references

* Fix broken setup_git command

* Add exec-ryujinx-tasks subcommand

* Ensure python and pipx are installed

* Improve help output

* Add required environment variables to README.md

* Add small script to generate subcommand sections automatically

* Adjust help messages for ryujinx tasks as well

* Remove required argument for positionals

* Add exec-ryujinx-tasks to subcommands list

* Apply black formatting

* Fix event name for update-reviewers
2024-01-27 20:49:49 +01:00

41 lines
1 KiB
Python

import argparse
import logging
from ryujinx_mako import commands
from ryujinx_mako._const import SCRIPT_NAME
from ryujinx_mako.commands import Subcommand
parser = argparse.ArgumentParser(
prog=SCRIPT_NAME,
description="A python module to aid Ryujinx with project management and moderation",
)
subparsers = parser.add_subparsers(
title="subcommands",
required=True,
)
subcommands = []
for subcommand in commands.SUBCOMMANDS:
subcommand_parser = subparsers.add_parser(
subcommand.name(),
description=subcommand.description(),
help=subcommand.description(),
)
Subcommand.add_subcommand(subcommand.name(), subcommand(subcommand_parser))
# Keep a reference to the subcommand
subcommands.append(Subcommand.get_subcommand(subcommand.name()))
def run():
logger = logging.getLogger(SCRIPT_NAME)
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.INFO)
args = parser.parse_args()
args.func(args)
if __name__ == "__main__":
run()