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

go-task is hard to use without knowing the go template engine #1679

Open
callegar opened this issue Jun 2, 2024 · 2 comments
Open

go-task is hard to use without knowing the go template engine #1679

callegar opened this issue Jun 2, 2024 · 2 comments
Labels
area: docs Changes related to documentation.

Comments

@callegar
Copy link

callegar commented Jun 2, 2024

I would like to see the go-task documentation expanded because currently it is very difficult to understand how to use go-task unless you have a go background.

From the documentation I am getting the impression that go-task should be a generic task runner / build tool and not a tool specific to go programmers. This impression comes from the fact that it is presented as a simpler and easier to use replacement for GNU Make and similar software.

However, it is currently very difficult to understand what can and cannot go within {{ }}. Specifically the page at https://golang.org/pkg/text/template/ that is linked in the documentation is not really easy to follow by those without a go programming background.

For instance: if I have a glob pattern, how do I put into a variable its expansion? If I have an array variable, can I flatten it into a string to pass it to the shell? Complex as it is, the GNU Make manual has an extended section about variables and functions applicable to them and it would be nice to have at least some more examples about how to use functions on variables in go-task.

Thanks for the attention.

@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Jun 2, 2024
@pd93
Copy link
Member

pd93 commented Jun 2, 2024

Hey @callegar. Funny that you mention this now. The next version of our docs will come with a Templating Reference page. You can view a preview of this here: https://taskfile.dev/next/reference/templating. This is only meant to provide a high-level overview of the functionality available in the templating engine and the variables/functions available, but it should be more than enough for most users.

Please let us know if you think there's anything missing here and we can make a decision as to whether more information needs adding.

@pd93 pd93 added state: awaiting response Waiting for issue author to respond. and removed state: needs triage Waiting to be triaged by a maintainer. labels Jun 2, 2024
@callegar
Copy link
Author

callegar commented Jun 3, 2024

This is great news! Thanks!

I have given just a quick peek at it, seems exactly what I was looking for! There are just minor things that maybe could be expanded:

  • I understand that current go-task supports variable of any type, not just strings but also maps and arrays. Examples on how to convert from non-string types to a single string and viceversa might be useful (e.g. split a string into an array, flatten an array into a string with delimiters and a joiner (this may be particularly useful to pass things to commands).
  • Examples on how to manage pathnames with spaces that are stored in string variables or array variables when passing them to commands.
  • Examples on file patterns and how to expand them into (array) variables.

@task-bot task-bot removed the state: awaiting response Waiting for issue author to respond. label Jun 3, 2024
@vmaerten vmaerten added the area: docs Changes related to documentation. label Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs Changes related to documentation.
Projects
None yet
Development

No branches or pull requests

4 participants