Initial Commit
This commit is contained in:
0
chinook/__init__.py
Normal file
0
chinook/__init__.py
Normal file
47
chinook/__main__.py
Normal file
47
chinook/__main__.py
Normal file
@@ -0,0 +1,47 @@
|
||||
import logging
|
||||
|
||||
from chinook import pipeline
|
||||
from argparse import ArgumentParser
|
||||
from pathlib import Path
|
||||
from semver import Version
|
||||
|
||||
|
||||
def main() -> None:
|
||||
formatter = logging.Formatter("%(asctime)s %(levelname)s %(message)s")
|
||||
console = logging.StreamHandler()
|
||||
console.setLevel(logging.DEBUG)
|
||||
console.setFormatter(formatter)
|
||||
|
||||
logger = logging.getLogger("chinook")
|
||||
logger.addHandler(console)
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
# Parent parser to all subcommands.
|
||||
parser = ArgumentParser(
|
||||
prog = "chinook",
|
||||
description = "Opinionated build tool for C/C++!"
|
||||
)
|
||||
|
||||
commands = parser.add_subparsers(required=True)
|
||||
buildcmd = commands.add_parser("build",help="Builds your Chinook project")
|
||||
buildcmd.set_defaults(func=pipeline.build)
|
||||
buildcmd.add_argument(
|
||||
"project",
|
||||
nargs="?",
|
||||
default=".",
|
||||
type=Path,
|
||||
help="The path to the project to build",
|
||||
metavar="PROJECT"
|
||||
)
|
||||
|
||||
print("\n".join([
|
||||
"┏┓┓ • ┓ ",
|
||||
"┃ ┣┓┓┏┓┏┓┏┓┃┏",
|
||||
"┗┛┛┗┗┛┗┗┛┗┛┛┗ v" + str(Version(major=0,minor=1,patch=0))
|
||||
]))
|
||||
arguments = parser.parse_args()
|
||||
arguments.func(arguments)
|
||||
|
||||
|
||||
# Auto execute.
|
||||
if __name__ == "__main__": main()
|
||||
1
chinook/models/__init__.py
Normal file
1
chinook/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from ._chinookfile import ChinookFile
|
||||
5
chinook/models/_chinookfile.py
Normal file
5
chinook/models/_chinookfile.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class ChinookFile:
|
||||
pass
|
||||
3
chinook/pipeline/__init__.py
Normal file
3
chinook/pipeline/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from ._build import build
|
||||
|
||||
__all__ = [ build ]
|
||||
25
chinook/pipeline/_build.py
Normal file
25
chinook/pipeline/_build.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from ..models import ChinookFile
|
||||
|
||||
from pathlib import Path
|
||||
from typing import overload
|
||||
|
||||
|
||||
@overload
|
||||
def build(path: Path) -> None: ...
|
||||
|
||||
@overload
|
||||
def build(file: ChinookFile) -> None: ...
|
||||
|
||||
|
||||
def build(value) -> None:
|
||||
if isinstance(value, Path):
|
||||
return _build_from_path(value)
|
||||
elif isinstance(value, ChinookFile):
|
||||
return _build_from_file(value)
|
||||
|
||||
|
||||
def _build_from_path(path: Path) -> None:
|
||||
pass
|
||||
|
||||
def _build_from_file(file: ChinookFile) -> None:
|
||||
pass
|
||||
Reference in New Issue
Block a user