|
| 1 | +#ifndef NUTSHELL_CONFIG_H |
| 2 | +#define NUTSHELL_CONFIG_H |
| 3 | + |
| 4 | +#include <stdbool.h> |
| 5 | + |
| 6 | +// Configuration structure to store settings |
| 7 | +typedef struct { |
| 8 | + char *theme; // Current theme name |
| 9 | + char **enabled_packages; // Array of enabled package names |
| 10 | + int package_count; // Number of enabled packages |
| 11 | + char **aliases; // Array of custom aliases |
| 12 | + char **alias_commands; // Array of commands for each alias |
| 13 | + int alias_count; // Number of aliases |
| 14 | + char **scripts; // Array of custom script paths |
| 15 | + int script_count; // Number of custom scripts |
| 16 | +} Config; |
| 17 | + |
| 18 | +// Global configuration |
| 19 | +extern Config *global_config; |
| 20 | + |
| 21 | +// Configuration functions |
| 22 | +void init_config_system(); |
| 23 | +void cleanup_config_system(); |
| 24 | + |
| 25 | +// Load configuration from files (checks dir, user, system in that order) |
| 26 | +bool load_config_files(); // Renamed from load_config to avoid conflict |
| 27 | + |
| 28 | +// Save current configuration to user config file |
| 29 | +bool save_config(); |
| 30 | + |
| 31 | +// Update specific configuration settings |
| 32 | +bool set_config_theme(const char *theme_name); |
| 33 | +bool add_config_package(const char *package_name); |
| 34 | +bool remove_config_package(const char *package_name); |
| 35 | +bool add_config_alias(const char *alias_name, const char *command); |
| 36 | +bool remove_config_alias(const char *alias_name); |
| 37 | +bool add_config_script(const char *script_path); |
| 38 | +bool remove_config_script(const char *script_path); |
| 39 | + |
| 40 | +// New functions for directory-level configuration |
| 41 | +bool reload_directory_config(); |
| 42 | +void cleanup_config_values(); |
| 43 | + |
| 44 | +// Get configuration settings |
| 45 | +const char *get_config_theme(); |
| 46 | +bool is_package_enabled(const char *package_name); |
| 47 | +const char *get_alias_command(const char *alias_name); |
| 48 | + |
| 49 | +#endif // NUTSHELL_CONFIG_H |
0 commit comments