Skip to content

Commit

Permalink
Implemented bluechi-is-online tool
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Engel <[email protected]>
  • Loading branch information
engelmi committed Oct 17, 2024
1 parent 0e8c2df commit c3ab410
Show file tree
Hide file tree
Showing 8 changed files with 647 additions and 0 deletions.
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ subdir('src/controller')
subdir('src/agent')
subdir('src/client')
subdir('src/proxy')
subdir('src/is-online')

# Subdirectory for the API description
subdir('data')
Expand Down
36 changes: 36 additions & 0 deletions src/is-online/help.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright Contributors to the Eclipse BlueChi project
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "help.h"
#include "opt.h"

static void usage_print_header() {
printf("bluechi-is-online checks and monitors the connection state of BlueChi components\n");
printf("\n");
}

static void usage_print_usage(const char *usage) {
printf("Usage: \n");
printf(" %s\n", usage);
printf("\n");
}


void usage() {
usage_print_header();
usage_print_usage("bluechi-is-online [agent|node|system] [OPTIONS]");
printf("Available commands:\n");
printf(" help: \t shows this help message\n");
printf(" version: \t shows the version of bluechi-is-online\n");
printf("Available options:\n");
printf(" --%s: \t keeps monitoring as long as [agent|node|system] is online and exits if it detects an offline state.\n",
ARG_MONITOR);
printf(" --%s: \t Wait n seconds for [agent|node|system] to get online.\n", ARG_WAIT);
}

int method_help(UNUSED Command *command, UNUSED void *userdata) {
usage();
return 0;
}
11 changes: 11 additions & 0 deletions src/is-online/help.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright Contributors to the Eclipse BlueChi project
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#pragma once

#include "libbluechi/cli/command.h"

int method_help(Command *command, void *userdata);
void usage();
Loading

0 comments on commit c3ab410

Please sign in to comment.