lack of config is handled more lax, began work for summoning a custom config

This commit is contained in:
anihilis 2026-02-17 09:33:48 -08:00
parent 474108c975
commit ac5e334956
2 changed files with 22 additions and 14 deletions

BIN
cclock

Binary file not shown.

View file

@ -151,6 +151,19 @@ for (int i = 1; i < argc; i++) {
case 'h': case 'h':
goto show_help; goto show_help;
show_help:
printf("Usage: %s [-HqTtCF]\n\n", argv[0]);
printf("Options:\n");
printf(" -t Use 12-hour time format\n");
printf(" -H Human-readable date (\"Tuesday 16, Feb\")\n");
printf(" -q Hide \"Press q to quit\" footer\n");
printf(" -T Hide temperature display\n");
printf(" -C Force Celsius\n");
printf(" -F Force Fahrenheit\n");
printf(" -h,--help Show this help\n");
return 0;
default: default:
printf("Unknown flag: -%c\n", argv[i][j]); printf("Unknown flag: -%c\n", argv[i][j]);
return 1; return 1;
@ -165,9 +178,14 @@ char config_path[512];
snprintf(config_path, sizeof(config_path), "%s/.config/cclock/config", getenv("HOME")); snprintf(config_path, sizeof(config_path), "%s/.config/cclock/config", getenv("HOME"));
if (!load_config_toml(&cfg, config_path)) { if (!load_config_toml(&cfg, config_path)) {
hide_temp = true;
printf("Failed to load config from %s\n", config_path); printf("Failed to load config from %s\n", config_path);
return 1;
} }
/* WORK IN PROGRESS CUSTOM_CONFIG
else if (custom_config = true) {
snprintf(config_path, sizeof(config_path), "%s/.config/cclock/config", getenv("HOME"));
}*/
/* NOW apply overrides */ /* NOW apply overrides */
@ -209,6 +227,9 @@ for (int i = 1; i < argc; i++) {
quiet = true; quiet = true;
break; break;
/*case 'c':
goto custom_config;*/
case 'h': case 'h':
goto show_help; goto show_help;
@ -294,18 +315,5 @@ for (int i = 1; i < argc; i++) {
curl_global_cleanup(); curl_global_cleanup();
endwin(); endwin();
/* Help/Usage output */
show_help:
printf("Usage: %s [-HqTtCF]\n\n", argv[0]);
printf("Options:\n");
printf(" -t Use 12-hour time format\n");
printf(" -H Human-readable date (\"Tuesday 16, Feb\")\n");
printf(" -q Hide \"Press q to quit\" footer\n");
printf(" -T Hide temperature display\n");
printf(" -C Force Celsius\n");
printf(" -F Force Fahrenheit\n");
printf(" -h,--help Show this help\n");
return 0; return 0;
} }