openSUSE / docmanager

Manage DocBook 5 Meta Information
http://opensuse.github.io/docmanager/index.html
GNU General Public License v3.0
6 stars 6 forks source link

Implement Query/Analyze Feature #49

Closed tomschr closed 9 years ago

tomschr commented 9 years ago

The current syntax is a bit strange. We would like to have a more compact syntax.

Let's say, we would like to have all files with have the following conditions:

The following are possible options:

  1. With --include/-I and --exclude/-E options (this was how DM2 did it)

    --include "maintainer=tux,wilber" --include "status=edited" --exclude "priority=2"
  2. With --query/-q (as one quoted string)

    -q "maintainer=tux,wilber;status=edited;-priority=2"
  3. With our standard options like --maintainer/-M

    --maintainer tux,wilber --status edited --not-priority 2

Which one should we prefer?

tomschr commented 9 years ago

analyze-plan

tomschr commented 9 years ago

Frank's Solution

Ok, after discussing with Frank, we found a fourth solution. The query/analyze subcommand is divided into two passes:

First pass (retrieving):

Second pass (output formatting):

The output can be influenced with the -q/--queryformat. The querystring has the following properties:

For example:

--queryformat "{filename} {maintainer} [{deadline}]\n"

The placeholders are in curely brackets which are replaced during output. A good(?) idea is to use syntax from the format specification used by the .format method.

See

Examples

  1. Return all files which are maintained by tux and are not in status "editing":

    docmanager query --filter "maintainer=tux" --filter "-status=editing"
  2. Same as (1), but sort it in descending filename order:

    docmanager query --filter "maintainer=tux" --filter "-status=editing" --sort="-filename"
mschnitzer commented 9 years ago

OK, I added the feature in https://github.com/openSUSE/docmanager/commit/de13116d96b32b965970b9c316bc446152ab0d96.

That is still missing:

mschnitzer commented 9 years ago

Fully implemented