aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.cli/command_node.ccm
blob: 25b5006e57dfbf044e4d184255e513424e5019d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// This source code is released into the public domain.
export module nihil.cli:command_node;

// command_node represents a possibly-invocable command.

import nihil.std;
import nihil.error;

namespace nihil {

export struct command_node {
	command_node(std::string_view path) noexcept;

	virtual ~command_node();

	[[nodiscard]] auto path(this command_node const &) noexcept
		-> std::string_view;

	[[nodiscard]] virtual auto invoke(int argc, char **argv) const
		-> std::expected<int, error>;

private:
	std::string	m_path;
};

} // namespace nihil