This is a useful alternative. 

Thanks!

On Thursday, September 30, 2021 at 2:57:45 AM UTC-6 ma...@jonrowe.co.uk 
wrote:

> I just quickly experimented, but whilst there doesn't seem to be a way to 
> access a task by its original name, you can invoke it directly with its 
> module name?
>
> ```
>   defp aliases do
>     [
>      # ... other aliases you might have
>       test: &reset_if_all_tests/1
>     ]
>   end
>
>   defp reset_if_all_tests(args) do
>     case args do
>       [] -> # invoke your database reset
>       _ -> # anything else
>     end
>     Mix.Tasks.Test.run(args)
>   end
> ```
>
> You could expand the logic of the function further to look for CI specific 
> env variables etc
>
> On Thu, 30 Sep 2021, at 7:24 AM, Generic Jam wrote:
>
>
> Right now one can override a mix task in mix.exs. It would be useful if 
> one could still access the 'original'.
>
> My use case:
>
> Our 'mix test' is remapped to reset the DB, etc which is what we need for 
> the CI, etc.
>
> However, I want to be able to run an individual test in order to drive the 
> code and I may not even need to touch the DB so resetting it is just a 
> waste of time. 
>
> Perhaps these tasks could have an underlying discoverable name that one 
> could use to still access them when they've been overridden.
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to elixir-lang-co...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elixir-lang-core/1ef2b1b2-77e2-4420-900d-f0b1f14860ccn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/elixir-lang-core/1ef2b1b2-77e2-4420-900d-f0b1f14860ccn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/6310dfc7-8e48-47a5-9bbd-c4960d5a13b6n%40googlegroups.com.

Reply via email to