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