Skip to content

Commit

Permalink
implement ElektraInitiative#2561 and enable -N for kdb get
Browse files Browse the repository at this point in the history
  • Loading branch information
dev2718 committed Sep 4, 2021
1 parent d1894c1 commit d621b14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
16 changes: 4 additions & 12 deletions src/tools/kdb/get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,13 @@ int GetCommand::execute (Cmdline const & cl)
KeySet conf;

kdb::Key root = cl.createKey (0);
string parentKeyName = cl.all ? "/" : cl.getParentKey (root).getName ();
kdb::KDB kdb (root);

std::string n;
if (cl.all)
{
n = root.getName ();
root.setName ("/");
}

std::string originalName = root.getName ();
root.setName (parentKeyName);
kdb.get (conf, root);

if (cl.all)
{
root.setName (n);
}
root.setName (originalName);

// do a lookup without tracer to warm up default cache
conf.lookup (root);
Expand Down
2 changes: 1 addition & 1 deletion src/tools/kdb/get.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class GetCommand : public Command

virtual std::string getShortOptions () override
{
return "an";
return "anN";
}

virtual std::string getSynopsis () override
Expand Down

0 comments on commit d621b14

Please sign in to comment.