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

Make task hidden from user, but callable from inside the Taskfile #295

Closed
ghost opened this issue Feb 12, 2020 · 9 comments
Closed

Make task hidden from user, but callable from inside the Taskfile #295

ghost opened this issue Feb 12, 2020 · 9 comments

Comments

@ghost
Copy link

ghost commented Feb 12, 2020

This might be useful for tasks preparing something, called from multiple other tasks.
Hiding the task from the user, eg. its not callable like task <hidden_task>, when the preparing stuff is not useful on its own.

@andreynering andreynering added the type: feature A new feature or functionality. label Feb 14, 2020
@andreynering
Copy link
Member

andreynering commented Feb 14, 2020

Hi @StevenKL,

You mean, like, private tasks? That was proposed before on #284.

I don't have a strong opinion on it.

@ghost
Copy link
Author

ghost commented Feb 14, 2020

Hello @andreynering,

just exactly like described in #284.
In the other Hand, we could usw a simple multiline script in a variable. But this meens We must call it every time. With a hidden task we can use its features like status or preconditions, also source and generates.

But i also think the user oft my Taskfile should be able to see that there is another, hidden/private task runnable.

As i think of it, is there an option to use a variable as precondition?
For example a RUN_IT: true for the hidden task and a simple precondition to evaluate that.

@andreynering
Copy link
Member

As i think of it, is there an option to use a variable as precondition?
For example a RUN_IT: true for the hidden task and a simple precondition to evaluate that.

Can you elaborate on that? I couldn't get what you mean.

@ghost
Copy link
Author

ghost commented Feb 18, 2020

Hello again,

my initial thought was to hide some tasks that do the heavy lifting and just export some control tasks.
Think of it just like a module in go with exported members.

I'm trying to use these Taskfiles as an interface for configuring and deploying our internal services and applications.

I want our employees to just hit task install or task update start without knowing what exactly is needed to do. Especially for a task like update, that is preparing containers and volumes to be saved/exported/what else in the background. It's just an example, but i hope you get what i mean.

But currently i don't know if this is enough for my use case. It might be also a practical idea to share some state between tasks. Something like mutable global vars, for example. But that's another story 😉

@tommyalatalo
Copy link

I second this request, there are definitely use cases for importing a taskfile and having only some of the tasks exposed while some are hidden private/support tasks.

@stephencheng

This comment was marked as off-topic.

@marco-m
Copy link
Contributor

marco-m commented Aug 21, 2020

If I understand correctly, something similar is already obtainable simply by not adding a desc or summary attribute to the task. To make it even clearer than one is not supposed to call the task directly, you could prefix them with an underscore: _foo (or am I missing something?).

Yes, it is only a convention, but IMHO a good-enough trade-off, that would keep task simpler. To make an example, Python doesn't have private methods :-)

@tylermmorton
Copy link
Contributor

tylermmorton commented Jan 17, 2022

Is this issue OK to close with the suggested workaround and the duplicate mentioned in #284? Perhaps an action item coming out of this could be to document the workaround in the usage docs file under a heading that is easily searchable like "Private Tasks" or "Hiding Tasks in task -l"

@kerma
Copy link
Contributor

kerma commented Mar 4, 2022

This is now covered with the help section and --list-all flag: https://github.com/go-task/task/blob/master/docs/usage.md#help

Please file a new issue if you feel like the docs need work on this.

@kerma kerma closed this as completed Mar 4, 2022
@pd93 pd93 removed the type: feature A new feature or functionality. label Dec 16, 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

No branches or pull requests

7 participants