robotcode icon indicating copy to clipboard operation
robotcode copied to clipboard

[ENHANCEMENT] Support for multiple TOML Files in `robot.toml`

Open d-biehl opened this issue 1 year ago • 1 comments

Description:

Overview: I would like to propose an enhancement for RobotCode to support the inclusion of external TOML files within the robot.toml configuration file. This feature would allow for a modular and organized configuration management approach, enabling users to maintain cleaner and more manageable TOML files.

Current Behavior: Currently, the robot.toml file does not support including other TOML files directly. Multiple configuration files can be specified via the command line, but this approach can become cumbersome and less intuitive for managing complex configurations.

Proposed Enhancement: I propose adding support for including external TOML files within the robot.toml file using a config_files directive. This directive would allow users to specify additional TOML files to be included and merged into the main configuration.

Example Usage: Here is an example of how the config_files directive could be used in robot.toml:


# Import additional configuration files
config-files = [
    "config/movement.toml",
    "config/sensors.toml",
    "config/actuators.toml"
]

extend-config-files = [
    "config/movement.toml",
    "config/sensors.toml",
    "config/actuators.toml"
]

The contents of the imported TOML files would be merged with the main robot.toml configuration. If there are conflicts, the values in the main robot.toml file would take precedence.

Benefits:

  1. Modularity: Allows for a more modular configuration setup, making it easier to manage large and complex configurations.
  2. Organization: Helps in organizing configurations by separating different aspects into individual files.
  3. Reusability: Promotes reusability of configuration files across different projects or components.
  4. Ease of Use: Simplifies the process of managing configurations without relying on command-line arguments.

Implementation Considerations:

  1. Parsing Order: The imported files should be parsed and merged in the order they are listed.
  2. Conflict Resolution: Clearly define how conflicts are resolved when merging configurations.
  3. Error Handling: Provide meaningful error messages if imported files are missing or contain invalid syntax.

Conclusion: Adding support for importing external TOML files in the robot.toml configuration file would greatly enhance the flexibility and manageability of configurations in RobotCode. This feature would complement the existing command-line options and provide a more intuitive way to handle complex configurations. I believe this feature would be a valuable addition and look forward to discussing its potential implementation.

d-biehl avatar Jul 29 '24 10:07 d-biehl