/src/WasmEdge/include/po/subcommand.h
Line | Count | Source (jump to first uncovered line) |
1 | | // SPDX-License-Identifier: Apache-2.0 |
2 | | // SPDX-FileCopyrightText: 2019-2024 Second State INC |
3 | | |
4 | | //===-- wasmedge/po/subcommand.h - SubCommand -----------------------------===// |
5 | | // |
6 | | // Part of the WasmEdge Project. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | #pragma once |
10 | | |
11 | | #include "po/helper.h" |
12 | | |
13 | | #include <string_view> |
14 | | #include <utility> |
15 | | |
16 | | namespace WasmEdge { |
17 | | namespace PO { |
18 | | |
19 | | using namespace std::literals; |
20 | | class SubCommand { |
21 | | public: |
22 | 0 | SubCommand() = default; |
23 | | template <typename... ArgsT> |
24 | | SubCommand(Description &&D, ArgsT &&...Args) |
25 | 0 | : SubCommand(std::forward<ArgsT>(Args)...) { |
26 | 0 | Desc = std::move(D.Value); |
27 | 0 | } |
28 | 0 | std::string_view description() const noexcept { return Desc; } |
29 | 0 | void select() noexcept { Selected = true; } |
30 | 0 | bool is_selected() const noexcept { return Selected; } |
31 | | |
32 | | private: |
33 | | std::string_view Desc; |
34 | | bool Selected = false; |
35 | | }; |
36 | | |
37 | | } // namespace PO |
38 | | } // namespace WasmEdge |