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 LS_H
10 : #define LS_H
11 :
12 : #include "coloredkdbio.hpp"
13 : #include <command.hpp>
14 : #include <kdb.hpp>
15 :
16 : class LsCommand : public Command
17 : {
18 : kdb::Key root;
19 : kdb::KDB kdb;
20 : kdb::KeySet ks;
21 :
22 : public:
23 : LsCommand ();
24 : ~LsCommand ();
25 :
26 65 : virtual std::string getShortOptions () override
27 : {
28 195 : return "mM0";
29 : }
30 :
31 65 : virtual std::string getSynopsis () override
32 : {
33 195 : return "<name>";
34 : }
35 :
36 143 : virtual std::string getShortHelpText () override
37 : {
38 429 : return "List the names of keys below a given name.";
39 : }
40 :
41 65 : virtual std::string getLongHelpText () override
42 : {
43 : return "List all keys below given name.\n"
44 : "To also retrieve the value use the\n"
45 195 : "export command.";
46 : }
47 :
48 : virtual int execute (Cmdline const & cmdline) override;
49 :
50 : private:
51 : void checkArguments (Cmdline const & cl);
52 : void printResults (kdb::KeySet const & part, const int rootDepth, Cmdline const & cl);
53 : int getDepth (kdb::Key const & key);
54 : bool shallShowNextLevel (const std::string argument);
55 : };
56 :
57 : #endif
|