Skip to content

Commit ee0542f

Browse files
committed
Improves build tools interface
1 parent 2f3dbfc commit ee0542f

22 files changed

+373
-330
lines changed

build.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
@echo off
2-
py scripts/build.py %*
2+
py scripts/crowtools.py %*

scripts/build.py

-30
This file was deleted.

scripts/command/command.py

-31
This file was deleted.

scripts/command/command_holder.py

-45
This file was deleted.

scripts/command/deploy_command.py

-43
This file was deleted.

scripts/command/help_command.py

-25
This file was deleted.

scripts/command/premake_command.py

-53
This file was deleted.

scripts/command/qt_command.py

-90
This file was deleted.

scripts/commands/__init__.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from commands.command import Command, CommandType
2+
from commands.command_holder import CommandHolder
3+
from commands.conan_command import ConanCommand
4+
from commands.qt_command import ConfigureQtCommand
5+
from commands.generate_command import GenerateCommand
6+
from commands.clear_command import ClearCommand
7+
from commands.deploy_command import DeployCommand

scripts/commands/clear_command.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from commands.command import Command
2+
from argparse import Namespace
3+
import subprocess
4+
5+
6+
class ClearCommand(Command):
7+
def __init__(self):
8+
super().__init__('clear', 'Clears project dependencies')
9+
10+
def setup(self, subparser):
11+
super().setup(subparser)
12+
13+
def execute(self, namespace: Namespace):
14+
super().execute(namespace)
15+
subprocess.run(['premake5', 'clear'], capture_output=True)

scripts/commands/command.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from argparse import Namespace, ArgumentParser
2+
from abc import ABC, abstractmethod
3+
from enum import Enum
4+
5+
6+
class CommandType(Enum):
7+
GENERAL = 0
8+
BUILD = 1
9+
10+
11+
class Command(ABC):
12+
def __init__(self, name: str, description: str, command_type: CommandType = CommandType.GENERAL):
13+
self.name = name
14+
self.type = command_type
15+
self.requires: list[dict] = []
16+
self.description = description
17+
self.parser: ArgumentParser | None = None
18+
19+
@abstractmethod
20+
def setup(self, subparser):
21+
self.parser: ArgumentParser = subparser.add_parser(self.name, help=self.description)
22+
23+
@abstractmethod
24+
def execute(self, namespace: Namespace):
25+
print(f"> Running {self.name}...")

0 commit comments

Comments
 (0)