fix(cli): correct output messages in the update menu

This commit is contained in:
Masahiko AMANO 2022-12-30 16:46:27 +03:00
parent 092188ac5e
commit 3939b30c15

View File

@ -305,7 +305,7 @@ int menu_upd_sasa(const char *arg) {
uint64_t sasa_id = strtoull(arg, &endptr, 16); uint64_t sasa_id = strtoull(arg, &endptr, 16);
if (*endptr == 0) { if (*endptr == 0) {
char *path = malloc(4096); char *path = malloc(4096);
printf(HIGHLIGHT("Enter the new file path (leave empty to keep current)\n")); printf(HIGHLIGHT("Enter the new file path (leave blank to keep current)\n"));
fgets(path, 4096, stdin); fgets(path, 4096, stdin);
if (*path == '\n') { if (*path == '\n') {
free(path); free(path);
@ -334,7 +334,7 @@ int menu_upd_tanzaku(const char *arg) {
uint64_t tanzaku_id = strtoull(arg, &endptr, 16); uint64_t tanzaku_id = strtoull(arg, &endptr, 16);
if (*endptr == 0) { if (*endptr == 0) {
char *name = malloc(4096), *description = malloc(4096); char *name = malloc(4096), *description = malloc(4096);
printf(HIGHLIGHT("Enter the new name of tanzaku (leave empty to keep current)\n")); printf(HIGHLIGHT("Enter the new name of tanzaku (leave blank to keep current)\n"));
fgets(name, 4096, stdin); fgets(name, 4096, stdin);
if (*name == '\n') { if (*name == '\n') {
free(name); free(name);
@ -342,7 +342,7 @@ int menu_upd_tanzaku(const char *arg) {
} else { } else {
name[strlen(name) - 1] = 0; name[strlen(name) - 1] = 0;
} }
printf(HIGHLIGHT("Enter the new description of tanzaku (leave empty to keep current)\n")); printf(HIGHLIGHT("Enter the new description of tanzaku (leave blank to keep current)\n"));
fgets(description, 4096, stdin); fgets(description, 4096, stdin);
if (*description == '\n') { if (*description == '\n') {
free(description); free(description);
@ -352,10 +352,10 @@ int menu_upd_tanzaku(const char *arg) {
} }
if (tanabata_tanzaku_upd(&tanabata, tanzaku_id, name, description) == 0 && if (tanabata_tanzaku_upd(&tanabata, tanzaku_id, name, description) == 0 &&
tanabata_save(&tanabata) == 0) { tanabata_save(&tanabata) == 0) {
printf(SUCCESS("Successfully updated sasa\n")); printf(SUCCESS("Successfully updated tanzaku\n"));
return 0; return 0;
} }
fprintf(stderr, ERROR("Failed to update sasa\n")); fprintf(stderr, ERROR("Failed to update tanzaku\n"));
return 1; return 1;
} }
fprintf(stderr, ERROR("Invalid ID\n")); fprintf(stderr, ERROR("Invalid ID\n"));