From 383ed08994b7af1d89bc23861d8df548fb45334c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Mon, 22 Jul 2024 15:44:05 +0200 Subject: [PATCH] feat: make messages consistent --- src/cli/command/config.c | 3 ++- src/cli/command/init.c | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cli/command/config.c b/src/cli/command/config.c index bd6ff9e..e6f2294 100644 --- a/src/cli/command/config.c +++ b/src/cli/command/config.c @@ -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; } diff --git a/src/cli/command/init.c b/src/cli/command/init.c index c80f11a..c4bab32 100644 --- a/src/cli/command/init.c +++ b/src/cli/command/init.c @@ -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");