Skip to content

client: names in compact output when listing resources#1443

Open
flxzt wants to merge 1 commit into
labgrid-project:masterfrom
flxzt:list-resources-names
Open

client: names in compact output when listing resources#1443
flxzt wants to merge 1 commit into
labgrid-project:masterfrom
flxzt:list-resources-names

Conversation

@flxzt

@flxzt flxzt commented Jul 15, 2024

Copy link
Copy Markdown
Contributor

Description

This adds that resources names are printed in the compact output of the labgrid-client resources command.

For example, instead of:

exporter-01/usbhub-p01/NetworkSerialPort
exporter-01/usbhub-p01/NetworkSerialPort

the output becomes

exporter-01/usbhub-p01/NetworkSerialPort[/modbus]
exporter-01/usbhub-p01/NetworkSerialPort[/serial-115200]

which makes it easier to differentiate between resources that have the same class.

The alternative would be to enable verbose printing with labgrid-client -v resources, but that adds a lot of other information and makes is quite hard to pick out the name quickly.

At least in my experience the resource name is the only info that I need 95% of the time, so I think it would be beneficial to add it to the default output.

What do you think?

  • PR has been tested

@Bastian-Krause

Copy link
Copy Markdown
Member

Sounds good. Is there a special reason for the square brackets? I would just drop them, so the match can be copy & pasted into labgrid-client add-match <match> directly.

@flxzt

flxzt commented Jul 18, 2024

Copy link
Copy Markdown
Contributor Author

I went with the brackets because they indicate that the name is optional when adding as a match and for consistency to the verbose output.

I don't have a strong opinion about either, should the verbose output be changed as well?

@flxzt
flxzt force-pushed the list-resources-names branch from d2a0acb to b17f570 Compare August 19, 2024 08:25
@flxzt

flxzt commented Feb 5, 2026

Copy link
Copy Markdown
Contributor Author

I would appreciate feedback here. @Bastian-Krause

@flxzt
flxzt force-pushed the list-resources-names branch from b17f570 to 37d7d22 Compare June 1, 2026 14:00
@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.0%. Comparing base (97e7cea) to head (7af0867).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@          Coverage Diff           @@
##           master   #1443   +/-   ##
======================================
  Coverage    61.0%   61.0%           
======================================
  Files         182     182           
  Lines       14874   14874           
======================================
+ Hits         9082    9084    +2     
+ Misses       5792    5790    -2     
Flag Coverage Δ
3.10 61.0% <100.0%> (ø)
3.11 61.0% <100.0%> (+<0.1%) ⬆️
3.12 61.0% <100.0%> (ø)
3.13 61.0% <100.0%> (ø)
3.14 61.0% <100.0%> (-0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Signed-off-by: Felix Zwettler <Felix.Zwettler@duagon.com>
@Emantor
Emantor force-pushed the list-resources-names branch from 37d7d22 to 7af0867 Compare July 8, 2026 10:15
@jluebbe

jluebbe commented Jul 8, 2026

Copy link
Copy Markdown
Member

In our lab, all exporters use resource configuration without names:

usb-hub-in-rack12:
  USBSerialPort:
    match:
      '@ID_PATH': 'pci-0000:05:00.0-usb-3-1.3'

instead of the named variant

usb-hub-in-rack12:
  console-main:
    cls: 'USBSerialPort'
    match:
      '@ID_PATH': 'pci-0000:05:00.0-usb-3-1.3'

We use the former, because the exporter configuration is relatively static and the "role" of a specific resource only becomes relevant when we add it to a specific place.

With this change, we'd get a lot of redundant information in the output, like this:

rlabQ-srv/q-usb-3-p1/NetworkSerialPort[/USBSerialPort]
rlabQ-srv/q-usb-3-p2/NetworkSerialPort[/USBSerialPort]
rlabQ-srv/q-usb-4-p10/NetworkSerialPort[/USBSerialPort]
rlabQ-srv/q-usb-4-p3/NetworkSerialPort[/USBSerialPort]
rlabQ-srv/q-usb-4-p3-1.1/NetworkSerialPort[/USBSerialPort]
rlabQ-srv/q-usb-4-p3-1.2/NetworkSerialPort[/USBSerialPort]

which could confuse users. I'm not sure how to handle both approaches equally well.

@flxzt

flxzt commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

I'm not sure how to handle both approaches equally well.

Would it make sense to introduce a -n/--names flag instead, only additionally showing the resource names when enabled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants