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

Pass the current task into the block #7

Closed
AlexDaniel opened this issue Jul 30, 2017 · 0 comments
Closed

Pass the current task into the block #7

AlexDaniel opened this issue Jul 30, 2017 · 0 comments
Assignees
Labels
testneeded Issue is generally resolved but tests were not written yet

Comments

@AlexDaniel
Copy link
Member

Otherwise there's no easy way to get the required information sometimes, as far as I can see. Block params are not used anyway, and passing it like this will make it available in $_.

I needed it when I wanted to use a junction as a task name (e.g. task ‘test’ | ‘t’, { … }), but still be able to see which one was used exactly. Sure, I can dive into @*ARGS but that's less than awesome.

From the top of my head:

     method execute { 
         return unless self.cond.();
         for self.deps -> $d { execute($d); }
-        self.body.(); 
+        self.body.(self); 
     }

+    method Str() {
+        $.name
+    }
AlexDaniel added a commit that referenced this issue Jun 22, 2018
As mentioned in issue #7, this can be useful sometimes. This change
should be backward compatible for most users, unless someone
explicitly restricted the signature (e.g. -> {…} instead of just {…}).

By the way, the default .gist of Sake-Task seems to be good enough.
@AlexDaniel AlexDaniel added the testneeded Issue is generally resolved but tests were not written yet label Jun 22, 2018
@AlexDaniel AlexDaniel self-assigned this Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testneeded Issue is generally resolved but tests were not written yet
Projects
None yet
Development

No branches or pull requests

1 participant