kaycxx-cli
C++ CLI library
Loading...
Searching...
No Matches
option_handle.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Klaus Reimer <k@ailis.de>
2// SPDX-License-Identifier: MIT
3
9#pragma once
10
11#include <utility>
12
13#include <kaycxx/cli/option.hpp>
14
15namespace kaycxx::cli {
16
24template <parseable_value T>
26public:
33 definition_->mark_as_action();
34 return *this;
35 }
36
43 return *definition_;
44 }
45
54 definition_->default_value(std::move(value));
55 return *this;
56 }
57
58private:
59 friend class command;
60
67 : definition_(&definition)
68 {}
69
71 option<T>* definition_;
72};
73
74} // namespace kaycxx::cli
Defines and parses a command line interface.
Definition command.hpp:68
Handle for a registered option.
Definition option_handle.hpp:25
option_handle action() noexcept
Marks the option as a mutually exclusive command action.
Definition option_handle.hpp:32
option< T > const & definition() const noexcept
Returns the underlying option definition.
Definition option_handle.hpp:42
option_handle default_value(T value)
Sets the default option value.
Definition option_handle.hpp:53
Defines command line options.