Skip to content

Commit

Permalink
dird: replacing custom CLI parsing with CLI11
Browse files Browse the repository at this point in the history
  • Loading branch information
alaaeddineelamri committed Jul 11, 2022
1 parent bce7f12 commit 62024a9
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 203 deletions.
35 changes: 22 additions & 13 deletions core/manpages/bareos-dir.8
Expand Up @@ -22,43 +22,52 @@ network backup system: it is responsible for scheduling and
coordinating backups across the network.
.SH OPTIONS
.TP
.BI \-c\ path
.BI \-c,--config\ path
Specify the configuration file or directory to use.
.TP
.BI \-d\ nn
.BI \-d,--debug-level\ nn
Set debug level to \fInn\fP.
.TP
.BI \-dt
.BI \--dt,--debug-timestamps
Print timestamp in debug output.
.TP
.BI \-f
.BI \-f,--foreground
Run in foreground (for debugging).
.TP
.BI \-g\ group
.BI \-g,--group\ group
Set the group/gid to run as.
.TP
.BI \-m
.BI \-m,--print-kaboom
Print kaboom output (for debugging).
.TP
.BI \-p\ file
.BI \-p,--pid-file\ file
Specify the full path to the pidfile.
.TP
.BI \-r\ job
.BI \-r,--run-job\ job
Run <job>.
.TP
.BI \-s
.BI \-s,--no-signals
No signals (for debugging).
.TP
.B \-t
.BI \-t,--test-config
Test the configuration and report errors.
.TP
.BI \-u\ user
.BI \-u,--user\ user
Set the username/uid to run as.
.TP
.BI \-v
.BI \-v,--verbose
Set verbose mode.
.TP
.BI \-?
.BI \--xc,--export-config\ [<resource_type> [<name>]]
Print all or specific configuration resources and exit.
.TP
.BI \--xs,--export-schema
Print configuration schema in JSON format and exit.
.TP
.BI \-z,--network-debugging
Switch network debugging on.
.TP
.BI \-h,--help,-?
Show version and usage of program.
.SH SEE ALSO
.BR bareos-fd (8),
Expand Down
8 changes: 4 additions & 4 deletions core/scripts/bareos-config-lib.sh.in
Expand Up @@ -580,13 +580,13 @@ set_config_param()
# - multiple directives in one line,
# separated by ";"
# (could by handled by RS="\n|;", but this could cause problems with other lines)
# Possible workaround: get expanded config by "bareos-* -xc"
# Possible workaround: get expanded config by "bareos-* --xc"
# - "}" must be the only character in a line
# - between "{" and the first directive must be a line break
# - Name directive must come before directive to modify,
# preferably Name is the first directive of a resource
# - does not handle includes ("@" and include scripts)
# Possible workaround: get expanded config by "bareos-* -xc"
# Possible workaround: get expanded config by "bareos-* --xc"

# configuration component (either file or bareos-dir, ...)
COMPONENT="${1}"
Expand Down Expand Up @@ -767,7 +767,7 @@ get_database_param()
# Retrieve PARAM line in configuration section output
# Beware we can be called before bareos-dir is installed on system (Debian like)
if [ -x "${BAREOS_DIRECTOR_BINARY}" ];then
CONFIG=$(${BAREOS_DIRECTOR_BINARY} -c "${BAREOS_CONFIG_DIR}" -xcCatalog="$CATALOG")
CONFIG=$(${BAREOS_DIRECTOR_BINARY} -c "${BAREOS_CONFIG_DIR}" --xc Catalog "$CATALOG")
if ! VALUE="$(get_config_line_parameter "${CONFIG}" "${PARAM}")"
then
# if default value is given, return it anyway
Expand Down Expand Up @@ -819,7 +819,7 @@ set_postgresql_environment_variables()
{
CATALOG="${1:-MyCatalog}"

if ! CONFIG=$(${BAREOS_DIRECTOR_BINARY} -c "${BAREOS_CONFIG_DIR}" -xcCatalog="${CATALOG}"); then
if ! CONFIG=$(${BAREOS_DIRECTOR_BINARY} -c "${BAREOS_CONFIG_DIR}" --xc Catalog "${CATALOG}"); then
error "Failed to get configuration of catalog $CATALOG"
error "${CONFIG}"
return 1
Expand Down
6 changes: 4 additions & 2 deletions core/src/dird/CMakeLists.txt
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2021 Bareos GmbH & Co. KG
# Copyright (C) 2017-2022 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down Expand Up @@ -158,7 +158,9 @@ target_link_libraries(
add_executable(bareos-dir)
target_sources(bareos-dir PRIVATE dird.cc)

target_link_libraries(bareos-dir PRIVATE dird_objects bareossql bareosfind)
target_link_libraries(
bareos-dir PRIVATE dird_objects bareossql bareosfind CLI11::CLI11
)

if(HAVE_WIN32)
target_sources(
Expand Down

0 comments on commit 62024a9

Please sign in to comment.