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

Add default slot values #15

Merged
merged 2 commits into from
Oct 16, 2024
Merged

Add default slot values #15

merged 2 commits into from
Oct 16, 2024

Conversation

andriygm
Copy link
Member

@andriygm andriygm commented Oct 16, 2024

Screen.Recording.2024-10-16.at.11.00.10.AM.mov

@andriygm andriygm requested a review from dpastoor October 16, 2024 14:58
@andriygm
Copy link
Member Author

@dpastoor wanted your thoughts on deferring default value behavior to consumers -- for example the CLI uses the default value within the prompt itself, but the actual generate function has no default value handling. if there is no value supplied, generate will not provide a default even if one is set for a slot.

@andriygm andriygm linked an issue Oct 16, 2024 that may be closed by this pull request
@dpastoor
Copy link
Member

I think generate should remain "dumb" to being given that context object or whatever. It is up to each tool to determine how it needs to handle defaults in line with what the user expresses. For example, IMO even then the answer could literally be that for our boolean inputs, if bool == FALSE then we literally skip adding it to the context so its missing and then we get the missing tera behavior of falsey.

This also makes sense around a webui vs cli vs flags etc all have slightly different ergonomics around how you express a default/missingness etc and even different defaults make sense. A cli with flags vs a prompt can have different default ergonomics that we can consider over time.

Does that answer the question?

Copy link
Member

@dpastoor dpastoor left a comment

Choose a reason for hiding this comment

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

nice - can we test this on the rprojectstarter with a default of true on renv for evidence then if that works LGTM

@andriygm
Copy link
Member Author

default value is yes on R-project-starter when no value is entered
Screenshot 2024-10-16 at 11 30 09 AM
true generates renv line, false does not
Screenshot 2024-10-16 at 11 30 32 AM

@andriygm andriygm merged commit a4b195a into main Oct 16, 2024
2 checks passed
@andriygm andriygm deleted the default-slot-vals branch October 16, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support default values for slots
2 participants