Project

General

Profile

Actions

Feature #19135

closed

Possibility to limit or add fields that are displayed

Added by Timo Goebel over 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Category:
Hammer core
Target version:
-
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

When using hammer cli it would be great if a user could say which columns / fields are printed when e.g. issuing a list command.

E.g. when I only want to see the name and vlanid column for subnet:
hammer subnet list --columns name,vlanid


Related issues 4 (1 open3 closed)

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

Actions
Related to Hammer CLI - Feature #24110: hammer host list add fields domain_name and last_checkinNewAditi PuntambekarActions
Has duplicate Hammer CLI - Feature #20743: Select certain fields for outputDuplicate08/25/2017Actions
Has duplicate Hammer CLI - Feature #12293: Control the attributes which are returned from a list commandDuplicateAkshay MendheActions
Actions #1

Updated by Tomáš Strachota over 7 years ago

Actions #2

Updated by Tomáš Strachota over 7 years ago

  • Has duplicate Feature #20743: Select certain fields for output added
Actions #3

Updated by Oleh Fedorenko over 6 years ago

  • Status changed from New to Assigned
  • Assignee set to Oleh Fedorenko
Actions #4

Updated by The Foreman Bot over 6 years ago

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

Updated by Tomáš Strachota over 6 years ago

  • Related to Feature #24110: hammer host list add fields domain_name and last_checkin added
Actions #6

Updated by Martin Bacovsky over 6 years ago

I'm going to sum up design discussion about this feature. tstrachota, ofedoren feel free to update/comment.

Commands will get a new option '--fields' (--columns could be confusing for base output adapter used in info commands):

subnet list --fields name,vlanid

Feature 'field set' will add predefined sets of fields
  • default field sets available for all commands are going to be THIN and ALL.
  • THIN is just 'id, name' and should use '?thin=true' in API for max optimization
  • fields and field sets can be added from plugins
  • name is ALLCAPS to distinguish between field name and set
subnet list --fields THIN
Things to figure out:
  • position of the option in the Main or end command?
    - in main command it does not work with shell
    - in individual commands it could conflict with options coming from API
  • can plugins remove fields from field sets?
  • allow combination of a field set and field names (host list --fields DEFAULT,my-filed)?
  • how to define the default filed set?
    - by field attribute :default => true/false (opt out) - hard to remove core filed from default set from plugin but works out of the box
    - by explicitly defining the DEFAULT field set - it would bring better control for plugins but we have to define the set before adding non-default fields
Actions #7

Updated by Tomáš Strachota over 6 years ago

position of the option in the Main or end command?

IMO it makes more sense to define it on the terminal command. I'd say that the chance for a name clash is minimal.

can plugins remove fields from field sets?

What would be the use-case for that?

allow combination of a field set and field names (host list --fields DEFAULT,my-filed)?

Definitely, it adds a lot of flexibilitty.

I'll add two things:
  • The option must be able to consume field labels that are presented to users, not keys that are used for looking up the data in API responses. E.g. --fields="Puppet environment" vs. --fields=environment
  • It should be possible to select nested fields like IPs of a NIC. E.g. --fields="Network interfaces/IP"
Actions #8

Updated by Tomáš Strachota over 6 years ago

  • Bugzilla link set to 1267445
Actions #9

Updated by Tomáš Strachota over 6 years ago

  • Has duplicate Feature #12293: Control the attributes which are returned from a list command added
Actions #10

Updated by The Foreman Bot almost 6 years ago

  • Pull request https://github.com/theforeman/hammer-cli-foreman/pull/407 added
Actions #11

Updated by Oleh Fedorenko over 5 years ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF