print help text to stdout instead of stderr

I looked it up and it would make sense to print it to stdout if the user
explicitly wants the help and to stderr if it's not intentional
This commit is contained in:
jacekpoz 2024-02-12 00:06:51 +01:00
parent 55414046ea
commit d8a0393fe1
No known key found for this signature in database
GPG key ID: 94E812A8B12AAE3C

View file

@ -50,11 +50,11 @@ int main(int argc, char *argv[]) {
}
if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) {
fprintf(stderr, "%s: modular fetch [%s]\n", PNAME, svtoa(VERSION));
fprintf(stderr, "\n");
fprintf(stderr, "OPTIONS\n");
fprintf(stderr, "\t-h, --help\t\t\tdisplays this help text\n");
fprintf(stderr, "\t-c, --config /path/to/config\tchanges config path from the default ($XDG_CONFIG_HOME/%s.conf)\n", PNAME);
printf("%s: modular fetch [%s]\n", PNAME, svtoa(VERSION));
printf("\n");
printf("OPTIONS\n");
printf("\t-h, --help\t\t\tdisplays this help text\n");
printf("\t-c, --config /path/to/config\tchanges config path from the default ($XDG_CONFIG_HOME/%s.conf)\n", PNAME);
exit(EXIT_SUCCESS);
}
}