mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-26 01:40:12 -05:00
main: add --check-config command line option
This commit is contained in:
parent
d11d374252
commit
86e7cb04c4
4 changed files with 19 additions and 1 deletions
14
main.c
14
main.c
|
|
@ -46,6 +46,7 @@ print_usage(const char *prog_name)
|
|||
"\n"
|
||||
"Options:\n"
|
||||
" -c,--config=PATH load configuration from PATH (XDG_CONFIG_HOME/footrc)\n"
|
||||
" --check-config verify configuration, exit with 0 if ok, otherwise exit with 1\n"
|
||||
" -f,--font=FONT comma separated list of fonts in fontconfig format (monospace)\n"
|
||||
" -t,--term=TERM value to set the environment variable TERM to (foot)\n"
|
||||
" --title=TITLE initial window title (foot)\n"
|
||||
|
|
@ -142,6 +143,7 @@ main(int argc, char *const *argv)
|
|||
|
||||
static const struct option longopts[] = {
|
||||
{"config", required_argument, NULL, 'c'},
|
||||
{"check-config", no_argument, NULL, 'C'},
|
||||
{"term", required_argument, NULL, 't'},
|
||||
{"title", required_argument, NULL, 'T'},
|
||||
{"app-id", required_argument, NULL, 'a'},
|
||||
|
|
@ -161,6 +163,7 @@ main(int argc, char *const *argv)
|
|||
{NULL, no_argument, NULL, 0},
|
||||
};
|
||||
|
||||
bool check_config = false;
|
||||
const char *conf_path = NULL;
|
||||
const char *conf_term = NULL;
|
||||
const char *conf_title = NULL;
|
||||
|
|
@ -181,7 +184,7 @@ main(int argc, char *const *argv)
|
|||
bool log_syslog = true;
|
||||
|
||||
while (true) {
|
||||
int c = getopt_long(argc, argv, "+c:t:a:Lf:g:s::Pp:l::Svh", longopts, NULL);
|
||||
int c = getopt_long(argc, argv, "+c:Ct:a:Lf:g:s::Pp:l::Svh", longopts, NULL);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
|
|
@ -190,6 +193,10 @@ main(int argc, char *const *argv)
|
|||
conf_path = optarg;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
check_config = true;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
conf_term = optarg;
|
||||
break;
|
||||
|
|
@ -320,6 +327,11 @@ main(int argc, char *const *argv)
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (check_config) {
|
||||
config_free(conf);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
setlocale(LC_CTYPE, "");
|
||||
LOG_INFO("locale: %s", setlocale(LC_CTYPE, NULL));
|
||||
if (!locale_is_utf8()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue