backup
This commit is contained in:
@@ -1,38 +1,34 @@
|
||||
|
||||
#include "src/data.h"
|
||||
#include "src/config_tools.h"
|
||||
#define GLOBAL_EDITOR
|
||||
|
||||
int main() {
|
||||
#include "include/config_tools.h"
|
||||
#include "include/data.h"
|
||||
|
||||
int main(void) {
|
||||
// Parse the configuration
|
||||
config_t *config = config_create();
|
||||
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) {
|
||||
if (config_parse_file(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);
|
||||
config_print_all();
|
||||
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("CTRL-s maps to: %s\n", config_get_key_mapping("CTRL-s"));
|
||||
printf("CTRL-f o maps to: %s\n", config_get_key_mapping("CTRL-f o"));
|
||||
printf("Window width: %d\n", config_get_int("window-width", 1024));
|
||||
printf("Theme: %s\n", config_get_string("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_get_bool("auto-save", false) ? "enabled" : "disabled");
|
||||
printf("Font size: %d\n", config_get_int("font-size", 12));
|
||||
|
||||
config_destroy(config);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user