Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling invalid column names on kctrl list commands #1502

Merged

Conversation

rcmadhankumar
Copy link
Contributor

@rcmadhankumar rcmadhankumar commented Mar 12, 2024

What this PR does / why we need it:

Handling invalid column names on kctrl list commands.

Sample Output:

$ ./kctrl package available list --column=name,source,status,since,namespace                                         
kctrl: Error: invalid column names: source,status,since

$ ./kctrl package installed list --column=name,source,status,since,namespace                                         
kctrl: Error: invalid column names: source,since

$ ./kctrl package repository list --column=name,source,status,since,namespace                                        
kctrl: Error: invalid column names: since

$./kctrl app list --column=name,source,status,ss                                                                      
kctrl: Error: invalid column names: source,ss

$./kctrl package repo get -r repo  --column name,invalid                                    
kctrl: Error: invalid column names: invalid

$ ./kctrl app get -a dep-pkgi-9bl8ur -n kappctrl-e2e-ns-2 --column=name,ns,invalid     
kctrl: Error: invalid column names: ns,invalid

$./kctrl package available get -p pkg.parent.carvel.dev/1.0.0 -n kappctrl-e2e-ns-2 --column=ns,test
kctrl: Error: invalid column names: ns,test

$ ./kctrl package installed get -i dep-pkgi-d3xoyb -n kappctrl-e2e-ns-2 --column=name,ns,test 
kctrl: Error: invalid column names: ns,test

$ ./kctrl app status -a dep-pkgi-9bl8ur -n kappctrl-e2e-ns-2 --column=name,ns,invalid       
kctrl: Error: invalid column names: ns,invalid

$ ./kctrl package installed status -i dep-pkgi-d3xoyb -n kappctrl-e2e-ns-2 --column=name,ns,test
kctrl: Error: invalid column names: ns,test

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?


Additional Notes for your reviewer:

Review Checklist:
  • Follows the developer guidelines
  • Relevant tests are added or updated
  • Relevant docs in this repo added or updated
  • Relevant carvel.dev docs added or updated in a separate PR and there's
    a link to that PR
  • Code is at least as readable and maintainable as it was before this
    change

Additional documentation e.g., Proposal, usage docs, etc.:


Copy link
Member

@praveenrewar praveenrewar left a comment

Choose a reason for hiding this comment

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

Can we also add a test for one of these commands?

@rcmadhankumar
Copy link
Contributor Author

Can we also add a test for one of these commands?

Tests are added.

@rcmadhankumar rcmadhankumar force-pushed the handle-invalid-column-names branch 3 times, most recently from 5770147 to 7e443bc Compare March 14, 2024 10:32
Copy link
Member

@praveenrewar praveenrewar left a comment

Choose a reason for hiding this comment

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

We use PrintTable in some other commands as well, do you think we should update those too since column flag is global?

cli/pkg/kctrl/cmd/app/list.go Outdated Show resolved Hide resolved
@rcmadhankumar rcmadhankumar force-pushed the handle-invalid-column-names branch 2 times, most recently from 1f93560 to e44e819 Compare March 18, 2024 09:58
@rcmadhankumar
Copy link
Contributor Author

We use PrintTable in some other commands as well, do you think we should update those too since column flag is global?

Updated all the commands which are using printTable.

Copy link
Member

@praveenrewar praveenrewar left a comment

Choose a reason for hiding this comment

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

Other than the one comment, it looks good.

cli/pkg/kctrl/cmd/core/validate_columns.go Outdated Show resolved Hide resolved
Signed-off-by: rcmadhankumar <rcmadhankumar@gmail.com>
@rcmadhankumar rcmadhankumar merged commit ae66c51 into carvel-dev:develop Mar 20, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants