kaycxx-cli
C++ CLI library
Loading...
Searching...
No Matches
repeatable_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
55 definition_->default_value(std::move(value));
56 return *this;
57 }
58
59private:
60 friend class command;
61
68 : definition_(&definition)
69 {}
70
72 option<T>* definition_;
73};
74
75} // 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 default_value(T value)
Sets the default option value.
Definition option_handle.hpp:53
Handle for a registered repeatable option.
Definition repeatable_option_handle.hpp:25
repeatable_option_handle default_value(T value)
Sets a default option value.
Definition repeatable_option_handle.hpp:54
repeatable_option_handle action() noexcept
Marks the option as a mutually exclusive command action.
Definition repeatable_option_handle.hpp:32
option< T > const & definition() const noexcept
Returns the underlying option definition.
Definition repeatable_option_handle.hpp:42
Defines command line options.