11# Plain2Code CLI Reference
22
33``` text
4- usage: generate_cli.py [-h] [--verbose] [--base-folder BASE_FOLDER] [--build-folder BUILD_FOLDER] [--log-to-file | --no-log-to-file]
5- [--log-file-name LOG_FILE_NAME] [--config-name CONFIG_NAME] [--render-range RENDER_RANGE | --render-from RENDER_FROM]
6- [--force-render] [--unittests-script UNITTESTS_SCRIPT] [--conformance-tests-folder CONFORMANCE_TESTS_FOLDER]
7- [--conformance-tests-script CONFORMANCE_TESTS_SCRIPT] [--prepare-environment-script PREPARE_ENVIRONMENT_SCRIPT]
8- [--test-script-timeout TEST_SCRIPT_TIMEOUT] [--api [API]] [--api-key API_KEY] [--full-plain] [--dry-run]
9- [--replay-with REPLAY_WITH] [--template-dir TEMPLATE_DIR] [--copy-build] [--build-dest BUILD_DEST]
10- [--copy-conformance-tests] [--conformance-tests-dest CONFORMANCE_TESTS_DEST] [--render-machine-graph]
11- [--logging-config-path LOGGING_CONFIG_PATH] [--headless]
4+ usage: generate_cli.py [-h] [--verbose] [--base-folder BASE_FOLDER]
5+ [--build-folder BUILD_FOLDER]
6+ [--log-to-file | --no-log-to-file]
7+ [--log-file-name LOG_FILE_NAME]
8+ [--config-name CONFIG_NAME]
9+ [--render-range RENDER_RANGE |
10+ --render-from RENDER_FROM] [--force-render]
11+ [--unittests-script UNITTESTS_SCRIPT]
12+ [--conformance-tests-folder CONFORMANCE_TESTS_FOLDER]
13+ [--conformance-tests-script CONFORMANCE_TESTS_SCRIPT]
14+ [--prepare-environment-script PREPARE_ENVIRONMENT_SCRIPT]
15+ [--test-script-timeout TEST_SCRIPT_TIMEOUT]
16+ [--api [API]] [--api-key API_KEY] [--full-plain]
17+ [--dry-run] [--replay-with REPLAY_WITH]
18+ [--template-dir TEMPLATE_DIR] [--copy-build]
19+ [--build-dest BUILD_DEST] [--copy-conformance-tests]
20+ [--conformance-tests-dest CONFORMANCE_TESTS_DEST]
21+ [--render-machine-graph]
22+ [--logging-config-path LOGGING_CONFIG_PATH]
23+ [--headless]
1224 filename
1325
14- Render plain code to target code.
26+ Render plain code to target code. Path arguments resolve based on where they
27+ were written: values given on the command line are resolved against the
28+ current working directory, values read from config.yaml are resolved against
29+ the config file's directory, and defaults are resolved against the directory
30+ containing the plain file. Absolute paths (and paths starting with '~') are
31+ used as-is.
1532
1633positional arguments:
17- filename Path to the plain file to render. The directory containing this file has highest precedence for template loading, so
18- you can place custom templates here to override the defaults. See --template-dir for more details about template
19- loading.
34+ filename Path to the plain file to render. The directory
35+ containing this file has highest precedence for
36+ template loading, so you can place custom templates
37+ here to override the defaults. See --template-dir for
38+ more details about template loading.
2039
2140options:
2241 -h, --help show this help message and exit
@@ -26,60 +45,89 @@ options:
2645 --build-folder BUILD_FOLDER
2746 Folder for build files
2847 --log-to-file, --no-log-to-file
29- Enable logging to a file. Defaults to True. Set to False to disable.
48+ Enable logging to a file. Defaults to True. Set to
49+ False to disable.
3050 --log-file-name LOG_FILE_NAME
31- Name of the log file. Defaults to 'codeplain.log'.Always resolved relative to the plain file directory.If file on
32- this path already exists, the already existing log file will be overwritten by the current logs.
51+ Name of the log file. Defaults to 'codeplain.log'. If
52+ a file already exists at the resolved path, it will be
53+ overwritten by the current logs.
3354 --render-range RENDER_RANGE
34- Specify a range of functionalities to render (e.g. `1` , `2`, `3`). Use comma to separate start and end IDs. If only
35- one functionality ID is provided, only that functionality is rendered. Range is inclusive of both start and end IDs.
55+ Specify a range of functionalities to render (e.g. `1`
56+ , `2`, `3`). Use comma to separate start and end IDs.
57+ If only one functionality ID is provided, only that
58+ functionality is rendered. Range is inclusive of both
59+ start and end IDs.
3660 --render-from RENDER_FROM
37- Continue generation starting from this specific functionality (e.g. `2`). The functionality with this ID will be
38- included in the output. The functionality ID must match one of the functionalities in your plain file.
61+ Continue generation starting from this specific
62+ functionality (e.g. `2`). The functionality with this
63+ ID will be included in the output. The functionality
64+ ID must match one of the functionalities in your plain
65+ file.
3966 --force-render Force re-render of all the required modules.
4067 --unittests-script UNITTESTS_SCRIPT
41- Shell script to run unit tests on generated code. Receives the build folder path as its first argument (default:
42- 'plain_modules').
68+ Shell script to run unit tests on generated code.
69+ Receives the build folder path as its first argument
70+ (default: 'plain_modules').
4371 --conformance-tests-folder CONFORMANCE_TESTS_FOLDER
4472 Folder for conformance test files
4573 --conformance-tests-script CONFORMANCE_TESTS_SCRIPT
46- Path to conformance tests shell script. Every conformance test script should accept two arguments: 1) Path to a
47- folder (e.g. `plain_modules/module_name`) containing generated source code, 2) Path to a subfolder of the conformance
48- tests folder (e.g. `conformance_tests/subfoldername`) containing test files.
74+ Path to conformance tests shell script. Every
75+ conformance test script should accept two arguments:
76+ 1) Path to a folder (e.g. `plain_modules/module_name`)
77+ containing generated source code, 2) Path to a
78+ subfolder of the conformance tests folder (e.g.
79+ `conformance_tests/subfoldername`) containing test
80+ files.
4981 --prepare-environment-script PREPARE_ENVIRONMENT_SCRIPT
50- Path to a shell script that prepares the testing environment. The script should accept the source code folder path as
51- its first argument.
82+ Path to a shell script that prepares the testing
83+ environment. The script should accept the source code
84+ folder path as its first argument.
5285 --test-script-timeout TEST_SCRIPT_TIMEOUT
53- Timeout for test scripts in seconds. If not provided, the default timeout of 120 seconds is used.
54- --api [API] Alternative base URL for the API. Default: `https://api.codeplain.ai`
55- --api-key API_KEY API key used to access the API. If not provided, the `CODEPLAIN_API_KEY` environment variable is used.
56- --full-plain Full preview ***plain specification before code generation.Use when you want to preview context of all ***plain
57- primitives that are going to be included in order to render the given module.
58- --dry-run Dry run preview of the code generation (without actually making any changes).
86+ Timeout for test scripts in seconds. If not provided,
87+ the default timeout of 120 seconds is used.
88+ --api [API] Alternative base URL for the API. Default:
89+ `https://api.codeplain.ai`
90+ --api-key API_KEY API key used to access the API. If not provided, the
91+ `CODEPLAIN_API_KEY` environment variable is used.
92+ --full-plain Full preview ***plain specification before code
93+ generation.Use when you want to preview context of all
94+ ***plain primitives that are going to be included in
95+ order to render the given module.
96+ --dry-run Dry run preview of the code generation (without
97+ actually making any changes).
5998 --replay-with REPLAY_WITH
6099 --template-dir TEMPLATE_DIR
61- Path to a custom template directory. Templates are searched in the following order: 1) Directory containing the plain
62- file, 2) Custom template directory (if provided through this argument), 3) Built-in standard_template_library
63- directory
64- --copy-build If set, copy the rendered contents of code in `--base-folder` folder to `--build-dest` folder after successful
65- rendering.
100+ Path to a custom template directory. Templates are
101+ searched in the following order: 1) Directory
102+ containing the plain file, 2) Custom template
103+ directory (if provided through this argument), 3)
104+ Built-in standard_template_library directory
105+ --copy-build If set, copy the rendered contents of code in `--base-
106+ folder` folder to `--build-dest` folder after
107+ successful rendering.
66108 --build-dest BUILD_DEST
67- Target folder to copy rendered contents of code to (used only if --copy-build is set).
109+ Target folder to copy rendered contents of code to
110+ (used only if --copy-build is set).
68111 --copy-conformance-tests
69- If set, copy the conformance tests of code in `--conformance-tests-folder` folder to `--conformance-tests-dest`
70- folder successful rendering. Requires --conformance-tests-script.
112+ If set, copy the conformance tests of code in
113+ `--conformance-tests-folder` folder to `--conformance-
114+ tests-dest` folder successful rendering. Requires
115+ --conformance-tests-script.
71116 --conformance-tests-dest CONFORMANCE_TESTS_DEST
72- Target folder to copy conformance tests of code to (used only if --copy-conformance-tests is set).
117+ Target folder to copy conformance tests of code to
118+ (used only if --copy-conformance-tests is set).
73119 --render-machine-graph
74120 If set, render the state machine graph.
75121 --logging-config-path LOGGING_CONFIG_PATH
76122 Path to the logging configuration file.
77- --headless Run in headless mode: no TUI, no terminal output except a single render-started message. All logs are written to the
78- log file.
123+ --headless Run in headless mode: no TUI, no terminal output
124+ except a single render-started message. All logs are
125+ written to the log file.
79126
80127configuration:
81128 --config-name CONFIG_NAME
82- Name of the config file to look for. Looked up in the plain file directory and the current working directory.
83- Defaults to config.yaml.
129+ Name of the config file to look for. Looked up in the
130+ plain file directory and the current working
131+ directory. Defaults to config.yaml.
84132
85133```
0 commit comments