This repository was archived by the owner on Mar 10, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
Implement CLI place Subcommand for Core Workflow Execution #22
Copy link
Copy link
Description
Description:
Implement the user-facing Command Line Interface (CLI) for the SCREAM++ application, focusing initially on the core place subcommand. This CLI will serve as the primary entry point for users to interact with the scream-core library. It will be responsible for parsing command-line arguments, loading configuration files, executing the main placement workflow, providing user feedback via progress indicators, and handling the writing of output files.
Tasks:
-
CLI Argument & Command Structure (
cli.rs)- Define Top-Level
CliStruct: Create the mainClistruct usingclap::Parserto define the application's version, author, and overall help message. - Define
CommandsEnum: Implement a subcommand enum to house all future commands (Place,Design,Analyze). - Define
PlaceArgsStruct: Create a struct for theplacesubcommand to define its specific arguments:-
--input/-i: Path to the input structure file. -
--output/-o: Path for the output structure file. -
--config/-c: Path to the workflow configuration TOML file. -
--force: A boolean flag to allow overwriting existing output files.
-
- Add Rich Help Messages: Use doc comments (
///) on all structs and fields to ensureclapgenerates comprehensive and user-friendly help text forscream --helpandscream place --help.
- Define Top-Level
-
Configuration Loading (
config.rs)- Implement
load_placement_configFunction: Create a dedicated function to handle the loading and parsing of the user-provided TOML configuration file. - Define File-Specific Structs: Use
serde::Deserializeto create temporary structs that exactly match the TOML file's structure. - Convert to Core Config: Use the
screampp::engine::config::PlacementConfigBuilderto convert the parsed TOML data into thePlacementConfigstruct required by thescream-corelibrary, providing clear error messages for missing or malformed fields.
- Implement
-
Workflow Execution Logic (
commands/place.rs)- Implement
executeFunction: Create the main logic function that takesPlaceArgsas input. - Orchestrate Workflow: The function will perform the following steps in sequence:
- Load the
PlacementConfigusing theconfig.rsmodule. - Load the input
MolecularSystemusing thescream-core::iomodule (e.g.,BgfFile). - Set up a
ProgressReporterand connect its callback to anindicatifProgressBarto provide real-time visual feedback to the user. - Call the
screampp::workflows::place::run()function with the loaded system, config, and reporter. - Process the
Result: handle success by saving the bestSolution's system to the specified output file, and handle errors by propagating them up.
- Load the
- Handle File I/O: Check if the output file exists and respect the
--forceflag.
- Implement
-
Error Handling & Main Entry Point (
error.rs,main.rs)- Define
CliErrorEnum: Create a custom, user-facing error enum usingthiserror. This enum will unify errors from different sources (I/O, TOML parsing,scream-coreengine) into a single type. - Implement
#[from]Trait: Use#[from]to enable automatic conversion from underlying error types (std::io::Error,toml::de::Error,screampp::engine::error::EngineError) intoCliError. - Implement
main.rs: Keep the main function clean. It should only parse the CLI arguments and dispatch to the appropriate command'sexecutefunction, wrapping the call in a top-level error handler that prints a user-friendly message upon failure.
- Define
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancement ✨New feature or requestNew feature or request