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

feat: invert call.Direct #1459

Merged
merged 1 commit into from
Jan 11, 2024
Merged

feat: invert call.Direct #1459

merged 1 commit into from
Jan 11, 2024

Conversation

pd93
Copy link
Member

@pd93 pd93 commented Jan 7, 2024

The API for taskfile/ast.Call.Direct isn't great when using Task as a Go package. Creating a task as if it were being called from the CLI means you have to write something like this:

call := ast.Call{Task: "default", Direct: true}

I can't think of many situations where you would want to set Direct: false from an API as this mainly intended for internal use when parsing a ast.Cmd or ast.Dep. Additionally, it's easy to forget to add Direct: true and omitting it is probably not the behaviour you want.

If we invert the property name from Direct to Indirect, the default value becomes false and so when calling a task with the API you would simply need to do:

call := ast.Call{Task: "default"}

@andreynering
Copy link
Member

Better, indeed. Thanks!

@andreynering andreynering merged commit 42af0fc into main Jan 11, 2024
11 checks passed
@andreynering andreynering deleted the invert-call-direct branch January 11, 2024 00:32
andreynering added a commit that referenced this pull request Jan 11, 2024
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.

2 participants