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

Node selection capability #541

Merged
merged 6 commits into from
Nov 1, 2024

Conversation

srikary12
Copy link
Contributor

Description

Adds node selection capability for .kitfile.

Linked issues

Fixes #462

@srikary12 srikary12 marked this pull request as ready for review October 23, 2024 18:31
@srikary12
Copy link
Contributor Author

@amisevsk I've added the required capabilites.

* Check filters for validity before attempting to use
* Accept filters that start with a '.' character (jq-style)
* Check validity of field at each step, to avoid reflect-related panics
* Minor refactoring to pull filtering into a separate function
Copy link
Contributor

@amisevsk amisevsk left a comment

Choose a reason for hiding this comment

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

Sorry I missed reviewing this until now @srikary12 -- the PR looks good and is a great early implementation that we can improve going forward (accessing items in arrays would be particularly useful). It works well for basic usage.

I pushed a few minor fixes to this PR before merging:

  • I pulled the filtering code to a separate function for clarity
  • I added basic validation for the filter (to avoid filters like model. or mod..el from crashing)
  • I switched the isValid() check to happen in the loop, to avoid reflect panicking on inputs like model.testone.testtwo, where testone leads to an invalid field
  • Finally, I made it handle filters that start with a dot (e.g. .model) since that's what I'm used to from using jq :)

Thanks again for the PR, this is great work 👍

@amisevsk amisevsk merged commit 9df82d1 into jozu-ai:main Nov 1, 2024
3 checks passed
@srikary12
Copy link
Contributor Author

srikary12 commented Nov 1, 2024

These are my first few contributions in go lang, I'll keep track of these suggestions and try to get better. Thanks.

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.

Add Node Selection Capability to kit info Command for Enhanced Kitfile Parsing
2 participants