feat: make messages consistent

This commit is contained in:
Jozef Steinhübl 2024-07-22 15:44:05 +02:00
parent 28750f38e6
commit 383ed08994
No known key found for this signature in database
GPG key ID: E6BC90C91973B08F
2 changed files with 6 additions and 5 deletions

View file

@ -7,7 +7,8 @@
int cli_command_config(int argc, char **argv) {
struct gimi_config *cfg = config_read();
if (!cfg) {
printf("Missing gimi config. Initialize it using gimi init command.");
printf(
"error: missing gimi config, initialize it using gimi init command.");
return 1;
}

View file

@ -12,23 +12,23 @@ int cli_command_init(int argc, char **argv) {
errno = 0;
int ret = mkdir(".gimi", S_IRWXU);
if (ret == -1 && errno != EEXIST) {
printf("Failed to initialize gimi.\n");
printf("error: failed to initialize gimi.\n");
return 1;
}
struct stat stats;
if (stat(".git", &stats) != 0 || !S_ISDIR(stats.st_mode)) {
printf("Missing .git directory. Use git init to initialize git.\n");
printf("error: missing .git directory, use git init to initialize git.\n");
return 1;
}
char cwd[PATH_MAX];
if (getcwd(cwd, sizeof(cwd)) == NULL) {
printf("Failed to get current working directory.\n");
printf("error: failed to get current working directory.\n");
return 1;
}
printf("Initialized gimi in %s/.gimi\n", cwd);
printf("info: initialized gimi in %s/.gimi\n", cwd);
FILE *file_ptr;
file_ptr = fopen(".gimi/config.toml", "w");