39 lines
1.1 KiB
C
39 lines
1.1 KiB
C
|
|
#include "src/data.h"
|
|
#include "src/config_tools.h"
|
|
|
|
int main() {
|
|
// Parse the configuration
|
|
config_t *config = config_create();
|
|
char *config_file = "init.bl";
|
|
if (!config) {
|
|
fprintf(stderr, "Error: Failed to create config structure\n");
|
|
return 1;
|
|
}
|
|
|
|
if (config_parse_file(config, config_file) != 0) {
|
|
fprintf(stderr, "Error: Failed to parse config file\n");
|
|
config_destroy(config);
|
|
return 1;
|
|
}
|
|
|
|
printf("Successfully parsed Lisp config file: %s\n\n", config_file);
|
|
|
|
// Print all entries
|
|
config_print_all(config);
|
|
printf("\n");
|
|
|
|
// Demonstrate usage
|
|
printf("Example usage:\n");
|
|
printf("CTRL-s maps to: %s\n", config_get_key_mapping(config, "CTRL-s"));
|
|
printf("CTRL-f o maps to: %s\n", config_get_key_mapping(config, "CTRL-f o"));
|
|
printf("Window width: %d\n", config_get_int(config, "window-width", 1024));
|
|
printf("Theme: %s\n", config_get_string(config, "theme", "light"));
|
|
printf("Auto-save: %s\n",
|
|
config_get_bool(config, "auto-save", false) ? "enabled" : "disabled");
|
|
printf("Font size: %d\n", config_get_int(config, "font-size", 12));
|
|
|
|
config_destroy(config);
|
|
return 0;
|
|
}
|