Skip to content

Commit

Permalink
implement ElektraInitiative#2561 for kdb meta-set/meta-get, enable -N…
Browse files Browse the repository at this point in the history
…,-f for kdb meta-set
  • Loading branch information
dev2718 committed Aug 25, 2021
1 parent e112051 commit a6db42a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/tools/kdb/metaget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ int MetaGetCommand::execute (Cmdline const & cl)
{
throw invalid_argument ("Need 2 arguments");
}
Key parentKey = cl.createKey (0);
Key k = cl.createKey (0);
Key parentKey = cl.getParentKey (cl.createKey (0));
string metaname = cl.arguments[1];

KeySet conf;
kdb.get (conf, parentKey);
printWarnings (cerr, parentKey, cl.verbose, cl.debug);

Key k = conf.lookup (parentKey);
k = conf.lookup (k);

if (!k)
{
Expand Down
2 changes: 1 addition & 1 deletion src/tools/kdb/metaget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MetaGetCommand : public Command

virtual std::string getShortOptions () override
{
return "n";
return "nN";
}

virtual std::string getSynopsis () override
Expand Down
8 changes: 5 additions & 3 deletions src/tools/kdb/metaset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ int MetaSetCommand::execute (Cmdline const & cl)
}
string metaname = cl.arguments[1];

Key parentKey = cl.createKey (0);
string keyname = parentKey.getName ();
Key k = cl.createKey (0);
string keyname = k.getName ();

bool cascadingWrite = keyname[0] == '/';

Key parentKey = cl.getParentKey (k);

KeySet conf;
kdb.get (conf, parentKey);
Key k = conf.lookup (parentKey);
k = conf.lookup (k);

if (!k)
{
Expand Down
2 changes: 1 addition & 1 deletion src/tools/kdb/metaset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MetaSetCommand : public Command

virtual std::string getShortOptions () override
{
return "q";
return "qNf";
}

virtual std::string getSynopsis () override
Expand Down

0 comments on commit a6db42a

Please sign in to comment.