UniSet 2.45.1
Пространство имен st2js.cli

Функции

argparse.ArgumentParser _build_parser ()
int main (list[str]|None args=None)
 _run_pipeline (str input_path, str|None mapping_path=None, list[str]|None program_filter=None, str main_program="Main", bool strict=False, bool struct_flatten=False, bool debug=False, bool ignore_undefined=False, list[str]|None cli_load_head=None, list[str]|None cli_load_on_start=None)
None _apply_auto_prefix_if_needed (list[tuple[str, Any]] ir_programs, 'SensorMapping' mapping)
 _run_multi_pipeline (list[str] input_paths, str|None mapping_path=None, list[str]|None program_filter=None, str main_program="Main", bool strict=False, bool struct_flatten=False, bool debug=False, bool ignore_undefined=False, list[str]|None cli_load_head=None, list[str]|None cli_load_on_start=None)

Подробное описание

CLI entry point for the st2js converter.

Provides main() function that wires the full pipeline:
  read ST file -> parse_st() -> transform() -> check_types() -> generate() -> write output

Usage:
  python -m st2js input.st -m mapping.yaml -o output.js
  python -m st2js input.st -m mapping.yaml          # output to stdout
  python -m st2js input.st -m mapping.yaml --strict
  python -m st2js input.st -m mapping.yaml --struct-flatten

Функции

◆ _apply_auto_prefix_if_needed()

None st2js.cli._apply_auto_prefix_if_needed ( list[tuple[str, Any]] ir_programs,
'SensorMapping' mapping )
protected
Check for name collisions across parsed IR and auto-assign prefixes.

Mutates mapping.files in-place. Only assigns prefixes to files
that don't already have them. Prefixes are p1_, p2_, ... by file order.

◆ _build_parser()

argparse.ArgumentParser st2js.cli._build_parser ( )
protected
Build and return the argument parser.

◆ _run_multi_pipeline()

st2js.cli._run_multi_pipeline ( list[str] input_paths,
str | None mapping_path = None,
list[str] | None program_filter = None,
str main_program = "Main",
bool strict = False,
bool struct_flatten = False,
bool debug = False,
bool ignore_undefined = False,
list[str] | None cli_load_head = None,
list[str] | None cli_load_on_start = None )
protected
Run conversion for multiple files and combine into one JS output.

Each file is converted independently with its own per-file mapping.
Results are combined into one JS: shared header, merged sensor arrays,
each file's body wrapped in a named function, single uniset_on_step
calling all file functions.

◆ _run_pipeline()

st2js.cli._run_pipeline ( str input_path,
str | None mapping_path = None,
list[str] | None program_filter = None,
str main_program = "Main",
bool strict = False,
bool struct_flatten = False,
bool debug = False,
bool ignore_undefined = False,
list[str] | None cli_load_head = None,
list[str] | None cli_load_on_start = None )
protected
Run the full ST-to-JS conversion pipeline.

Returns:
    Tuple of (JavaScript source string, GenerateStats).

◆ main()

int st2js.cli.main ( list[str] | None args = None)
Main entry point for the st2js converter.

Args:
    args: Command-line arguments (default: sys.argv[1:]).

Returns:
    Exit code: 0 on success, 1 on error.