Skip to content

Commit 89a17c3

Browse files
committed
Added support for the --version command-line option.
1 parent 28da778 commit 89a17c3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
static gboolean opt_delete = FALSE;
2222
static gboolean opt_checksum = FALSE;
2323
static gboolean opt_size_only = FALSE;
24+
static gboolean opt_version = FALSE;
2425

2526
static GOptionEntry opt_entries[] =
2627
{
2728
{ "size-only", 's', 0, G_OPTION_ARG_NONE, &opt_size_only, "Skip files that match in size", NULL },
2829
{ "checksum", 'c', 0, G_OPTION_ARG_NONE, &opt_checksum, "Skip files based on checksum, not size and modified time", NULL },
2930
{ "delete", 'd', 0, G_OPTION_ARG_NONE, &opt_delete, "Delete extraneous files from destination directories", NULL },
31+
{ "version", 'V', 0, G_OPTION_ARG_NONE, &opt_version, "Show the program's version and quit", NULL },
3032
{ NULL }
3133
};
3234

@@ -62,6 +64,12 @@ main (int argc, char **argv)
6264
return 1;
6365
}
6466

67+
if (opt_version)
68+
{
69+
g_print ("%s\n", PACKAGE_STRING);
70+
return 0;
71+
}
72+
6573
if (argc < 2)
6674
{
6775
g_printerr ("%s: Command line option parsing failed: %s.\n", g_get_prgname (), "Source location missing");

0 commit comments

Comments
 (0)