Skip to content

Conversation

@ashearin
Copy link
Member

Description

Fixes spdx SBOMs not getting full cache ID printed in list cmd.

Dynamically sets column width for ID and Alias contents. version and # nodes are still static widths

Determines terminal width and total table width needed, prints out a list of SBOMs if the width of terminal is smaller than width of table. otherwise prints out the table.

Fixes #162

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Output when width of table is less than width of terminal:

$ go run . list

                                                     ID                                                      │    Alias     │ Version │ # Nodes 
─────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────────┼─────────┼─────────
 urn:uuid:f360ad8b-dc41-4256-afed-337a04dff5db                                                               │ bomctl_0.3.0 │    1    │    6    
 https://anchore.com/syft/file/bomctl_0.3.0_linux_amd64.tar.gz-1b838d44-9d3c-47d0-9f7f-846397e701fa#DOCUMENT │              │    0    │   81    

Output if terminal width is less than table width:

$ go run . list
ID: urn:uuid:f360ad8b-dc41-4256-afed-337a04dff5db
Alias: bomctl_0.3.0
Version: 1
# Nodes: 6

ID: https://anchore.com/syft/file/bomctl_0.3.0_linux_amd64.tar.gz-1b838d44-9d3c-47d0-9f7f-846397e701fa#DOCUMENT
Alias: 
Version: 0
# Nodes: 81

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@ashearin ashearin self-assigned this Sep 18, 2024
@ashearin ashearin requested a review from a team as a code owner September 18, 2024 16:28
@ashearin ashearin linked an issue Sep 18, 2024 that may be closed by this pull request
@ashearin ashearin added this to the Minimum Viable Project milestone Sep 18, 2024
@ashearin ashearin added bug Something isn't working enhancement New feature or request labels Sep 18, 2024
@ashearin ashearin requested a review from jhoward-lm September 19, 2024 16:46
Copy link
Contributor

@lmphil lmphil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@ashearin ashearin merged commit c5cb545 into main Sep 19, 2024
@ashearin ashearin deleted the 162-bug-spdx-ids-from-bomctl-list-not-usable branch September 19, 2024 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

BUG: SPDX IDs from bomctl list not usable

5 participants