feat(awesome: main: check): print config path, and do it to stdout (#2901)

feat(awesome: main: check): combine two error messages together

feat(awesome: main: check): print newline before ERROR

chore(awesome: check): change message

Co-Authored-By: Uli Schlachter <psychon@users.noreply.github.com>

Co-authored-by: Uli Schlachter <psychon@users.noreply.github.com>
This commit is contained in:
Yauhen Kirylau 2021-05-24 06:55:04 +02:00 committed by GitHub
parent 59789bc2cf
commit b65025ef62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -619,13 +619,14 @@ main(int argc, char **argv)
bool success = true;
/* Get the first config that will be tried */
const char *config = luaA_find_config(&xdg, confpath, true_config_callback);
fprintf(stdout, "Checking config '%s'... ", config);
/* Try to parse it */
lua_State *L = luaL_newstate();
if(luaL_loadfile(L, config))
{
const char *err = lua_tostring(L, -1);
fprintf(stderr, "%s\n", err);
fprintf(stdout, "\nERROR: %s\n", err);
success = false;
}
p_delete(&config);
@ -633,12 +634,11 @@ main(int argc, char **argv)
if(!success)
{
fprintf(stderr, "✘ Configuration file syntax error.\n");
return EXIT_FAILURE;
}
else
{
fprintf(stderr, "✔ Configuration file syntax OK.\n");
fprintf(stdout, "OK\n");
return EXIT_SUCCESS;
}
}