brettbeatty

brettbeatty

Library for accelerating mix task development

At my work we build a lot of mix tasks for backfills and other maintenance tasks. Even with OptionParser we seem to copy a lot of boilerplate between tasks. I’m wondering if folks would prefer a more batteries-included solution for building mix tasks, maybe even a domain-specific language for declaring options and such.

I’ve built a library called Executive, not published on Hex, and I’m looking for feedback on whether folks would use something like it (is there already something like it I’m missing?) or anything y’all would change.

It provides a mix task for generating mix tasks:

mix executive.gen.task my_object.do_something --uuid id --required \
  --string cursor --datetime after --pos-integer batch_size --start-application

Running that task would generate a mix task that could get called as

mix my_object.do_something --id a7cde5bd-3878-42f9-b439-d49fd4ba37f9 \
  --cursor b219859c98bb --after 2024-01-15T12:34:56Z --batch-size 500

Inside the mix task, you declare a bunch of options like this:

@optdoc "whether you want a or b or c"
option :my_option, {:enum, [:a, :b, :c]}

And Executive implements c:Mix.Task.run/1, parses the options assertively, and calls c:Executive.Task.run/2 with the parsed options. But since the options are declared, it can also build docs and types and such for the task.

Where Next?

Popular in RFCs Top

senconscious
EctoJuno is a package that provides parsing, validation and applying sorting parameters for your ecto queries on models. Currently sortin...
New
tmbb
I’ve started working on a toy project to compile extended POSIX-compatible regular expressions into NimbleParsec combinators. These combn...
New
wingyplus
Hi, I start working on the fork version of Elixir GRPC. What I’ve done is the past few days: Support Elixir 1.11+ Support OTP 23+ OTP...
New
KristerV
I got fed up with removing unused aliases manually so made a package for it: GitHub - KristerV/remove_unused_ex: Remove unused aliases an...
New
tiagodavi
I’ve just created and published my first Elixir library! Ex4j combines the power of Ecto schema with the Bolt protocol + an elegant DSL ...
New
bortzmeyer
Not a replacement for serious authoritative DNS servers, of course, but useful for some uses (such as returning the IP address of the DNS...
New
brettbeatty
At my work we build a lot of mix tasks for backfills and other maintenance tasks. Even with OptionParser we seem to copy a lot of boilerp...
New
ca1989
Hi all, this week I played a bit with Phoenix and Elm. I ended up with this POC: https://github.com/carlotm/elmex The repository cont...
New
zachallaun
Hey gang, I’ve been using Req as my primary client for a project I’ve been working on that interacts with a number of APIs, and I quickl...
New
zachallaun
Note: There are a few folks I’d really love to hear from, time permitting. Pinging in case the title isn’t catchy enough :slight_smile: @...
New

Other popular topics Top

peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> someth...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

We're in Beta

About us Mission Statement