Skip to content

Commit

Permalink
Only print options if there are any
Browse files Browse the repository at this point in the history
  • Loading branch information
e01306821 committed Mar 19, 2019
1 parent 054f4a4 commit acf72f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions doc/help/kdb-get.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ kdb get -n /tests/get/examples/kdb-get/key
kdb get -v /tests/get/examples/kdb-get/key
#> got 3 keys
#> searching spec/tests/get/examples/kdb-get/key, found: <nothing>, options: KDB_O_CALLBACK
#> searching proc/tests/get/examples/kdb-get/key, found: <nothing>, options:
#> searching dir/tests/get/examples/kdb-get/key, found: <nothing>, options:
#> searching user/tests/get/examples/kdb-get/key, found: user/tests/get/examples/kdb-get/key, options:
#> searching proc/tests/get/examples/kdb-get/key, found: <nothing>
#> searching dir/tests/get/examples/kdb-get/key, found: <nothing>
#> searching user/tests/get/examples/kdb-get/key, found: user/tests/get/examples/kdb-get/key
#> The resulting keyname is user/tests/get/examples/kdb-get/key
#> The resulting value size is 6
#> myKey
Expand All @@ -91,7 +91,7 @@ kdb get -v /tests/get/examples/kdb-get/anotherKey
#> defaultValue

kdb rm user/tests/get/examples/kdb-get/key
kdb rmmeta spec/tests/get/examples/kdb-get/anotherKey default
kdb rm spec/tests/get/examples/kdb-get/anotherKey
```

To use bookmarks:<br>
Expand Down
8 changes: 6 additions & 2 deletions src/tools/kdb/get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,13 @@ ckdb::Key * printTrace (ELEKTRA_UNUSED ckdb::KeySet * ks, ckdb::Key * key, ckdb:
std::cout << " ";

std::cout << "searching " << (k.getName ()[0] == '/' ? "default of spec" : "") << k.getName ()
<< ", found: " << (found ? f.getName () : "<nothing>") << ", options: ";
<< ", found: " << (found ? f.getName () : "<nothing>");

printOptions (options);
if (options)
{
std::cout << ", options: ";
printOptions (options);
}
std::cout << std::endl;

if (k.getName ().substr (0, 5) == "spec/" && (options & ckdb::KDB_O_CALLBACK))
Expand Down

0 comments on commit acf72f7

Please sign in to comment.