Skip to content

Commit 8aea21d

Browse files
committed
add version and help help pages
1 parent 3f09845 commit 8aea21d

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

src/help.c

+23-7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "pg_probackup.h"
1212

1313
static void help_nocmd(void);
14+
static void help_internal(void);
1415
static void help_init(void);
1516
static void help_backup(void);
1617
static void help_restore(void);
@@ -27,6 +28,7 @@ static void help_archive_push(void);
2728
static void help_archive_get(void);
2829
static void help_checkdb(void);
2930
static void help_help(void);
31+
static void help_version(void);
3032

3133
void
3234
help_print_version(void)
@@ -64,10 +66,10 @@ help_command(ProbackupSubcmd const subcmd)
6466
&help_set_backup,
6567
&help_show_config,
6668
&help_checkdb,
67-
&help_nocmd, // SSH_CMD
68-
&help_nocmd, // AGENT_CMD
69+
&help_internal, // SSH_CMD
70+
&help_internal, // AGENT_CMD
6971
&help_help,
70-
&help_help, // VERSION_CMD
72+
&help_version,
7173
};
7274

7375
Assert((int)subcmd < sizeof(help_functions) / sizeof(help_functions[0]));
@@ -77,9 +79,9 @@ help_command(ProbackupSubcmd const subcmd)
7779
void
7880
help_pg_probackup(void)
7981
{
80-
printf(_("\n%s - utility to manage backup/recovery of PostgreSQL database.\n\n"), PROGRAM_NAME);
82+
printf(_("\n%s - utility to manage backup/recovery of PostgreSQL database.\n"), PROGRAM_NAME);
8183

82-
printf(_(" %s help [COMMAND]\n"), PROGRAM_NAME);
84+
printf(_("\n %s help [COMMAND]\n"), PROGRAM_NAME);
8385

8486
printf(_("\n %s version\n"), PROGRAM_NAME);
8587

@@ -256,7 +258,13 @@ help_pg_probackup(void)
256258
static void
257259
help_nocmd(void)
258260
{
259-
printf(_("Unknown command. Try pg_probackup help\n"));
261+
printf(_("\nUnknown command. Try pg_probackup help\n\n"));
262+
}
263+
264+
static void
265+
help_internal(void)
266+
{
267+
printf(_("\nThis command is intended for internal use\n\n"));
260268
}
261269

262270
static void
@@ -984,5 +992,13 @@ help_archive_get(void)
984992
static void
985993
help_help(void)
986994
{
987-
printf(_("No help page required for \"help\" and \"version\" commands. Just try it!\n"));
995+
printf(_("\n%s help [command]\n"), PROGRAM_NAME);
996+
printf(_("%s command --help\n\n"), PROGRAM_NAME);
997+
}
998+
999+
static void
1000+
help_version(void)
1001+
{
1002+
printf(_("\n%s version\n"), PROGRAM_NAME);
1003+
printf(_("%s --version\n\n"), PROGRAM_NAME);
9881004
}

src/utils/configuration.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ char const *
140140
get_subcmd_name(ProbackupSubcmd const subcmd)
141141
{
142142
Assert((int)subcmd < sizeof(subcmd_names) / sizeof(subcmd_names[0]));
143-
return subcmd_names[(int)subcmd];
143+
return subcmd_names[(int)subcmd];
144144
}
145145

146146
/*

0 commit comments

Comments
 (0)