parse_inputs
This commit is contained in:
parent
aff3a8180a
commit
7dc9f06e47
1 changed files with 17 additions and 2 deletions
19
spcd/act.py
19
spcd/act.py
|
@ -1,6 +1,7 @@
|
||||||
"""Actions available for workflows."""
|
"""Actions available for workflows."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from ast import literal_eval
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from rwx import ps
|
from rwx import ps
|
||||||
|
@ -9,15 +10,29 @@ from rwx.log import stream as log
|
||||||
from spcd.ci import project, projects
|
from spcd.ci import project, projects
|
||||||
from spcd.shell import env
|
from spcd.shell import env
|
||||||
|
|
||||||
|
PREFIX = "INPUT_"
|
||||||
|
|
||||||
|
|
||||||
def action() -> None:
|
def action() -> None:
|
||||||
"""Display action inputs."""
|
"""Display action inputs."""
|
||||||
prefix = "INPUT_"
|
|
||||||
for variable, value in sorted(projects.environment.items()):
|
for variable, value in sorted(projects.environment.items()):
|
||||||
if variable.startswith(prefix):
|
if variable.startswith(PREFIX):
|
||||||
log.info("%s = %s", variable, value)
|
log.info("%s = %s", variable, value)
|
||||||
|
|
||||||
|
|
||||||
|
def parse_inputs() -> dict[str, object]:
|
||||||
|
"""Parse inputs as a dictionary.
|
||||||
|
|
||||||
|
:return: name & value pairs
|
||||||
|
:rtype: dict[str, object]
|
||||||
|
"""
|
||||||
|
d = {}
|
||||||
|
for variable, value in sorted(projects.environment.items()):
|
||||||
|
if variable.startswith(PREFIX):
|
||||||
|
d[variable] = literal_eval(value)
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
def synchronize(source: str | None = None, target: str | None = None) -> None:
|
def synchronize(source: str | None = None, target: str | None = None) -> None:
|
||||||
"""Synchronize output towards a target.
|
"""Synchronize output towards a target.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue