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 SHELL_GET_HPP
10 : #define SHELL_GET_HPP
11 :
12 : #include <command.hpp>
13 :
14 : #include <kdb.hpp>
15 :
16 : class ShellGetCommand : public Command
17 : {
18 :
19 : public:
20 : ShellGetCommand ();
21 : ~ShellGetCommand ();
22 :
23 60 : virtual std::string getShortOptions () override
24 : {
25 180 : return "";
26 : }
27 :
28 60 : virtual std::string getSynopsis () override
29 : {
30 180 : return "<name> <default value>";
31 : }
32 :
33 138 : virtual std::string getShortHelpText () override
34 : {
35 414 : return "Get the value of an individual key within a shell script.";
36 : }
37 :
38 60 : virtual std::string getLongHelpText () override
39 : {
40 : return "The get command does not work properly within shell scripts\n"
41 : "because it may issue an error instead of printing a value.\n"
42 : "ShellGet guarantees that no error is printed, in any event\n"
43 : "(except for wrong parameters and options)\n"
44 : "a value will be printed, either the one retrieved from the\n"
45 : "system or a fallback default value given as second\n"
46 180 : "parameter";
47 : }
48 :
49 : virtual int execute (Cmdline const & cmdline) override;
50 : };
51 :
52 : #endif
|