Skip to content

Commit 9c2730a

Browse files
committed
Command changes. set-config/show-config instead of config command
1 parent 0acc911 commit 9c2730a

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

pg_probackup.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ main(int argc, char *argv[])
133133
backup_subcmd = SHOW;
134134
else if (strcmp(argv[1], "delete") == 0)
135135
backup_subcmd = DELETE;
136-
else if (strcmp(argv[1], "config") == 0)
137-
backup_subcmd = CONFIGURE;
136+
else if (strcmp(argv[1], "set-config") == 0)
137+
backup_subcmd = SET_CONFIG;
138+
else if (strcmp(argv[1], "show-config") == 0)
139+
backup_subcmd = SHOW_CONFIG;
138140
else if (strcmp(argv[1], "--help") == 0
139141
|| strcmp(argv[1], "help") == 0
140142
|| strcmp(argv[1], "-?") == 0)
@@ -170,7 +172,7 @@ main(int argc, char *argv[])
170172
elog(ERROR, "-B, --backup-path must be a path to directory");
171173

172174
/* Do not read options from file or env if we're going to set them */
173-
if (backup_subcmd != CONFIGURE)
175+
if (backup_subcmd != SET_CONFIG)
174176
{
175177
/* Read options from configuration file */
176178
join_path_components(path, backup_path, BACKUP_CATALOG_CONF_FILE);
@@ -248,12 +250,14 @@ main(int argc, char *argv[])
248250
return do_retention_purge();
249251
else
250252
return do_delete(current.backup_id);
251-
case CONFIGURE:
252-
/* TODO fixit */
253+
case SHOW_CONFIG:
254+
if (argc > 4)
255+
elog(ERROR, "show-config command doesn't accept any options");
256+
return do_configure(true);
257+
case SET_CONFIG:
253258
if (argc == 4)
254-
return do_configure(true);
255-
else
256-
return do_configure(false);
259+
elog(ERROR, "set-config command requires at least one option");
260+
return do_configure(false);
257261
}
258262

259263
return 0;

pg_probackup.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ typedef enum ProbackupSubcmd
107107
VALIDATE,
108108
SHOW,
109109
DELETE,
110-
CONFIGURE
110+
SET_CONFIG,
111+
SHOW_CONFIG
111112
} ProbackupSubcmd;
112113

113114
/* special values of pgBackup fields */

0 commit comments

Comments
 (0)