- introduced -f|--format command-line option
- implemented formatters 'simple', 'json', 'multiline' (=current output)
Details
- Reviewers
vhanda smithjd lbeltrame - Group Reviewers
Frameworks - Commits
- R293:a7150492b691: balooctl status: Produce parseable output
$ balooctl status -h
$ balooctl status /existing/path/* /not/existing/path [--format xxx]
JSON well-formed check:
$ balooctl status /existing/path/* /not/existing/path -f json | jq '.'
Diff Detail
- Repository
- R293 Baloo
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
I'm not too fond of assembling JSON by hand, but I guess it was done to avoid dependencies for a tool that's supposed to be simple. I'll let others weigh in on this.
Did you test this change also with filenames with Unicode characters or non-Latin characters?
src/tools/balooctl/statuscommand.cpp | ||
---|---|---|
122 | Small nit: space after ":". | |
149 | What do those replace operations do? |
I'm not too fond of assembling JSON by hand, but I guess it was done to avoid dependencies for a tool that's supposed to be simple.
Qt's JSON support is in QtCore since Qt 5, there's no additional dependency, so yes, please use QJsonDocument et at.
@broulik: My reasons for not using it
- I was a little lazy: Using all the other Qt-Objects was enough work for me :).
- I thought not using QJsonDocument was accapteble because the overall structure of the formatters is similar.
Should you insist on QJsonDocument I'll use it of course.
src/tools/balooctl/statuscommand.cpp | ||
---|---|---|
122 | This way one can ... | cut -d ':' -f2- otherwise you have to get rid of leading space. | |
149 | escape double quotes |
Did you test this change also with filenames with Unicode characters or non-Latin characters?
Yes. Example:
Once I found an example (Qt doc) it was easy. Yesterday was struggling with this command line parsing to much :)
BTW, regarding
balooctl status -h
The --format look like a global switch. I don't like that. Couldn't find a(n easy) way to avoid that. Do you know one?
The subcommands are defined as posititional arguments after all.
The --format look like a global switch. I don't like that. Couldn't find a(n easy) way to avoid that. Do you know one?
The subcommands are defined as posititional arguments after all.
Apparently it's not possible in Qt (but I might be wrong).
Just learned it's on the Qt-wishlist. I can live with that. Just wanted to get rid of the 2nd description line.
Changes are trivial enough IMO. Perhaps wait one or two days to see if anyone objects, then you can land this.