Skip to content

Commit

Permalink
feat: TOOLS-2842 add build to version output (#87)
Browse files Browse the repository at this point in the history
* feat: TOOLS-2842 add build to version output

* feat: add build id to asrestore version command

---------

Co-authored-by: dylan <dwelch@aerospike.com>
  • Loading branch information
jdogmcsteezy and dwelch-spike committed Mar 1, 2024
1 parent 48f591b commit 26a0147
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 12 deletions.
31 changes: 25 additions & 6 deletions src/backup_config.c
Expand Up @@ -41,7 +41,7 @@ extern char *aerospike_client_version;
// Forward Declarations.
//

static void print_version(void);
static void print_version();
static void usage(const char *name);

//==========================================================
Expand Down Expand Up @@ -1244,12 +1244,31 @@ backup_config_allow_uncovered_partitions(const backup_config_t* conf)
* Print the tool's version information.
*/
static void
print_version(void)
print_version()
{
fprintf(stdout, "Aerospike Backup Utility\n");
fprintf(stdout, "Version %s\n", TOOL_VERSION);
fprintf(stdout, "C Client Version %s\n", aerospike_client_version);
fprintf(stdout, "Copyright 2015-2021 Aerospike. All rights reserved.\n");
char* build = NULL;
char* version_cpy = strdup(TOOL_VERSION);
char* token = strtok(version_cpy, "-");
char* version = token;

token = strtok(NULL, "-");

while (token != NULL) {
token = strtok(NULL, "-");

if (token != NULL) {
build = token;
}
}

fprintf(stdout, "Aerospike Backup\n");
fprintf(stdout, "Version %s\n", version);

if (build != NULL) {
fprintf(stdout, "Build %s\n", build);
}

free(version_cpy);
}

/*
Expand Down
31 changes: 25 additions & 6 deletions src/restore_config.c
Expand Up @@ -42,7 +42,7 @@ extern char *aerospike_client_version;
// Forward Declarations.
//

static void print_version(void);
static void print_version();
static void usage(const char* name);

//==========================================================
Expand Down Expand Up @@ -1057,12 +1057,31 @@ restore_config_from_cloud(const restore_config_t* conf)
* Print the tool's version information.
*/
static void
print_version(void)
print_version()
{
fprintf(stdout, "Aerospike Restore Utility\n");
fprintf(stdout, "Version %s\n", TOOL_VERSION);
fprintf(stdout, "C Client Version %s\n", aerospike_client_version);
fprintf(stdout, "Copyright 2015-2021 Aerospike. All rights reserved.\n");
char* build = NULL;
char* version_cpy = strdup(TOOL_VERSION);
char* token = strtok(version_cpy, "-");
char* version = token;

token = strtok(NULL, "-");

while (token != NULL) {
token = strtok(NULL, "-");

if (token != NULL) {
build = token;
}
}

fprintf(stdout, "Aerospike Restore\n");
fprintf(stdout, "Version %s\n", version);

if (build != NULL) {
fprintf(stdout, "Build %s\n", build);
}

free(version_cpy);
}

/*
Expand Down

0 comments on commit 26a0147

Please sign in to comment.