ReUseX
0.0.5
3D Point Cloud Processing for Building Reuse
Toggle main menu visibility
Loading...
Searching...
No Matches
exit_status.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2025 Povl Filip Sonne-Frederiksen
2
//
3
// SPDX-License-Identifier: GPL-3.0-or-later
4
5
#pragma once
6
7
#include <
global-params.hpp
>
8
9
#include <CLI/Error.hpp>
10
11
#include <algorithm>
12
13
namespace
rux
{
14
23
inline
int
exit_code_for
(
int
status) {
24
if
(status ==
RuxError::SUCCESS
)
25
return
0;
26
const
long
code = status < 0 ? -
static_cast<
long
>
(status) : status;
27
return
static_cast<
int
>
(std::clamp<long>(code, 1, 125));
28
}
29
47
inline
void
finish
(
int
status) {
48
if
(status !=
RuxError::SUCCESS
)
49
throw
CLI::RuntimeError(
exit_code_for
(status));
50
}
51
52
}
// namespace rux
global-params.hpp
SUCCESS
@ SUCCESS
Definition
global-params.hpp:36
rux
Definition
stage_bridge.hpp:25
rux::finish
void finish(int status)
Hand a run_subcommand_* status to CLI11 so that it reaches the process exit code.
Definition
exit_status.hpp:47
rux::exit_code_for
int exit_code_for(const reusex::pipeline::StageResult &result)
Map a library stage outcome onto a rux exit code.
Definition
stage_bridge.hpp:32
apps
rux
include
exit_status.hpp
Generated by
1.17.0