Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
faermanj committed Oct 18, 2023
1 parent cb4fbfd commit 6de74c3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
25 changes: 16 additions & 9 deletions up_cli/src/up_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
import pluggy
from dataclasses import dataclass
from typing import List
from typing import TypeAlias
from typing import Callable

hookimpl = pluggy.HookimplMarker("up")
pm = pluggy.PluginManager("up")

def match_prompt(prompt, head, image):
if not prompt:
return None
if prompt[0] == head:
return image
return None

# https://docker-py.readthedocs.io/en/stable/containers.html
@dataclass
class RunConfig:
name: str
image: str
command: List[str]
command: list[str]
environment: dict[str, str]
ports: dict[str, str]
auto_remove: bool = True
network_mode: str = "host"
# volumes: dict[str, str]

RunConfigs:TypeAlias = list[RunConfig]
Prompt:TypeAlias = list[str]

def match_prompt(prompt: Prompt,
mk_run_config: Callable[[], RunConfig],
*args) -> list[RunConfig]:
if not prompt:
return None
#TODO: implement matching
return None


5 changes: 1 addition & 4 deletions up_cli/src/up_cli/hookspec.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import pluggy

from up_cli import Prompt, RunConfigs

hookspec = pluggy.HookspecMarker("up")

RunConfigs = List[float]
Prompt = list[str]

@hookspec(firstresult=True)
def to_run_configs(prompt: Prompt) -> RunConfigs:
"""Present run configurations to execute for prompt"""
Expand Down

0 comments on commit 6de74c3

Please sign in to comment.