lack of config is handled more lax, began work for summoning a custom config
This commit is contained in:
parent
474108c975
commit
ac5e334956
2 changed files with 22 additions and 14 deletions
BIN
cclock
BIN
cclock
Binary file not shown.
36
cclock.c
36
cclock.c
|
|
@ -151,6 +151,19 @@ for (int i = 1; i < argc; i++) {
|
|||
case 'h':
|
||||
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:
|
||||
printf("Unknown flag: -%c\n", argv[i][j]);
|
||||
return 1;
|
||||
|
|
@ -165,9 +178,14 @@ char config_path[512];
|
|||
snprintf(config_path, sizeof(config_path), "%s/.config/cclock/config", getenv("HOME"));
|
||||
|
||||
if (!load_config_toml(&cfg, config_path)) {
|
||||
hide_temp = true;
|
||||
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 */
|
||||
|
||||
|
|
@ -209,6 +227,9 @@ for (int i = 1; i < argc; i++) {
|
|||
quiet = true;
|
||||
break;
|
||||
|
||||
/*case 'c':
|
||||
goto custom_config;*/
|
||||
|
||||
case 'h':
|
||||
goto show_help;
|
||||
|
||||
|
|
@ -294,18 +315,5 @@ for (int i = 1; i < argc; i++) {
|
|||
|
||||
curl_global_cleanup();
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue