Project

General

Profile

Actions

Bug #19191

closed

It's impossible to create output formatter that applies only on tables but not on basic output

Added by Tomáš Strachota about 7 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
Category:
Hammer core
Target version:
-
Difficulty:
Triaged:
No
Team Backlog:
Marek
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

Currently before a column is printed hammer selects a set of formatters to apply based on tags. Only formatters with tags that match set of output adapter's tags are selected. This system is good for adding formatters but it's impossible to exclude a formatter from being used with some adapters.

For example I wanted to add formatter that would squeeze multiline values onto one line for tabular output. There's no way how to limit usage of such formatter only to tables.


Related issues 1 (0 open1 closed)

Related to Hammer CLI - Tracker #14914: Tracker for output related issuesClosed

Actions
Actions #1

Updated by Tomáš Strachota about 7 years ago

Actions #2

Updated by The Foreman Bot over 5 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli/pull/284 added
Actions #3

Updated by Oleh Fedorenko over 5 years ago

  • Assignee set to Oleh Fedorenko
  • Triaged set to No
Actions #4

Updated by Martin Bacovsky over 5 years ago

It is possible to use tags to limit formatter to specific adapter. The logic is that all the tags in formatter needs to be present in adapter. E.g. to have the tabular only formatter it would be enough to add :table tag to Table adapter so that it is

    def tags
      [:screen, :flat, :table]
    end

Such addition does not break anything until we remove tags. Then formatter with just the :table tag will be applicable only in Tabular output.

So as a solution here I'd suggest to add tag with adapter name to each of the adapters.

The only remaining issue is when we want to exclude some formatter from certain adapter but i'd like to know the real use case. If we have one we could add no_tags to formatter and update the match? method to take it into account.

Would that be acceptable?

Actions #5

Updated by Oleh Fedorenko about 5 years ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF