New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let kdb get -v display if value comes from default #2499
Let kdb get -v display if value comes from default #2499
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think I am the right person to review this pull request, since I usually do not work on anything related to the spec
namespace. Anyway, as far as I can tell, the code looks good. I think it would be a good idea to create a Markdown Shell Recorder test in kdb-get.md
, to make sure the feature works as intended. For an example, on how to do that please take a look at:
libelektra/doc/help/kdb-complete.md
Lines 47 to 95 in 674120e
```sh | |
# Backup-and-Restore: user/tests/complete/examples | |
# Create the keys we use for the examples | |
kdb set user/tests/complete/examples/kdb-complete/level1 foo | |
kdb set user/tests/complete/examples/kdb-complete/lvl1/lvl2 bar | |
kdb set user/tests/complete/examples/kdb-complete/lvl1/lvl2/lvl3/lvl4/lvl5 fizz | |
kdb set user/tests/complete/examples/kdb-complete/buzz fizzBuzz | |
kdb set user/tests/complete/examples/kdb-complete/#array_1 asdf | |
kdb set user/tests/complete/examples/kdb-complete/% nothing | |
# list suggestions for namespaces starting with us, only the current level | |
kdb complete us --max-depth=1 | |
#> user/ | |
# list suggestions for namespaces starting with user, only the current level | |
kdb complete user --max-depth=1 | |
#> user/ | |
# list suggestions for the namespace user, only the next level as it ends with / | |
# note the difference to the previous example, which uses no trailing / | |
kdb complete user/ --max-depth=1 | |
# STDOUT-REGEX: .+ | |
# list all possible namespaces or mount points, only the current level | |
kdb complete --max-depth=1 | |
# STDOUT-REGEX: .+ | |
# list suggestions for /tests/complete/examples/kdb-complete, only the current level | |
kdb complete /tests/complete/examples/kdb-complete --max-depth=1 | |
#> user/tests/complete/examples/kdb-complete/ | |
# list suggestions for /tests/complete/examples/kdb-complete/, only the next level | |
# again, note the difference to the previous example which has no trailing / | |
kdb complete /tests/complete/examples/kdb-complete/ --max-depth=1 | |
#> user/tests/complete/examples/kdb-complete/% | |
#> user/tests/complete/examples/kdb-complete/#array_1 | |
#> user/tests/complete/examples/kdb-complete/buzz | |
#> user/tests/complete/examples/kdb-complete/level1 | |
#> user/tests/complete/examples/kdb-complete/lvl1/ | |
# list suggestions for /tests/complete/examples/kdb-complete which are minimum 2 levels | |
# away from that key, and maximum 4 levels away | |
kdb complete /tests/complete/examples/kdb-complete/ --min-depth=2 --max-depth=4 | |
#> user/tests/complete/examples/kdb-complete/lvl1/lvl2/lvl3/ | |
#> user/tests/complete/examples/kdb-complete/lvl1/lvl2/lvl3/lvl4/ | |
kdb rm -r user/tests/complete/examples/kdb-complete | |
``` |
and:
add_msr_test (kdb_complete "${CMAKE_SOURCE_DIR}/doc/help/kdb-complete.md") |
.
@@ -173,6 +173,7 @@ you up to date with the multi-language support provided by Elektra. | |||
|
|||
## Tools | |||
|
|||
- `kdb get -v` now displays if the resulting value is a default-value defined by the metadata of the key. _(Thomas Bretterbauer)_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the trailing space character in this line. After you do that the test testscr_check_formatting
should not fail anymore.
Thanks for your review! I'll address your findings |
Fixes ElektraInitiative#2474 Added release notes Using char-array directly Added markdown-tests and removed space in release-notes
354cb56
to
054f4a4
Compare
I've added shell recorder tests for /doc/help/kdb-get.md which resulted in reformatting the existing examples. Example-output: Therefore this test fails without this character. Should I ignore this failure in this case? |
I think we can safely remove the space from the output (or even options: if there are none). @sanssecours is this a bug in the Markdown formatter? Imho it should not reformat any source code. |
I think it should work, if you
. |
Alternatively, we could simply not output "options" if there are none. |
Thanks for your help! I've removed the options-output if there are no options to print. @markus2330 please review my pull request |
I do not think so.
In my opinion removing trailing whitespace should be a standard feature of every formatting tool 😊. The nice thing is that
I do not know, if you noticed it yet, but the test
. |
bde0793
to
d0847a8
Compare
scripts/jenkins/Jenkinsfile
Outdated
def ctest(target = "Test", testName = "Testname") { | ||
|
||
/* | ||
We disable the test `testshell_markdown_kdb_get` if the storage plugin INI is used, because it adds keys in between levels which |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the proper location to disable the test is the CMake code, otherwise the test will still fail, if someone uses INI as default storage plugin and runs the test suite locally. Sorry if that was not clear from the suggestions in my previous comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am also happy with the solution in this PR (if it works). I think people should not get the impression that the INI plugin works flawlessly, as it does not. Afaik nobody (except us on the build server) currently runs the tests with INI as default storage. I think soon it will be even okay to completely remove the INI-as-default tests, as we decided to use YAML and not INI as future default storage (for good reasons).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback!
First I'll try to figure out why my test still gets executed on debian-stable-full-ini. If I don't find my error, I'll look into the CMake code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix in the CMake code most likely is much easier as many such fixes already exist.
See doc/todo/TESTING for a list of disabled tests. Please also add your test into this list.
7dba21e
to
b09022a
Compare
b09022a
to
cf0e9f1
Compare
The test now requires the dump storage plugin to run. Is that an acceptable solution? |
It is, in my opinion 😊. It would be great, if you could mount the
That is a known problem. I restarted the failed build jobs. |
Thank you very much for your contribution! Everything is now nice and clean! |
src/tools/kdb/get.cpp
I've added the check after the final key-lookup inside the execute-method. If the printTrace-method is the better place for this please let me know and I'll find a way to retrieve the information there.
Close #2474
Checklist
Check relevant points but please do not remove entries.
For docu fixes, spell checking, and similar none of these points below
need to be checked.
Review
@markus2330 please review my pull request