Line data Source code
1 : /**
2 : * @file
3 : *
4 : * @brief
5 : *
6 : * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
7 : */
8 :
9 : #ifndef VALIDATION_HPP
10 : #define VALIDATION_HPP
11 :
12 : #include <command.hpp>
13 :
14 : #include <kdb.hpp>
15 :
16 : class ValidationCommand : public Command
17 : {
18 : kdb::KDB kdb;
19 :
20 : public:
21 : ValidationCommand ();
22 : ~ValidationCommand ();
23 :
24 1 : virtual std::string getShortOptions () override
25 : {
26 3 : return "";
27 : }
28 :
29 1 : virtual std::string getSynopsis () override
30 : {
31 3 : return "<key-name> <value> <regular expression> [<message>]";
32 : }
33 :
34 79 : virtual std::string getShortHelpText () override
35 : {
36 237 : return "Set a value together with a validation regex.";
37 : }
38 :
39 1 : virtual std::string getLongHelpText () override
40 : {
41 : return "This is a convenience function to set validation metadata for a key.\n"
42 : "It supports regular expressions as defined in extended regular expressions.\n"
43 : "\n"
44 : "The message is shown whenever someone tries to set a value which does\n"
45 : "not match the regular expression."
46 : "\n"
47 : "The command will only work if the validation plugin is mounted\n"
48 3 : "where the key resides.";
49 : }
50 :
51 : virtual int execute (Cmdline const & cmdline) override;
52 : };
53 :
54 : #endif
|