brettbeatty

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 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? Top

Trending in RFCs Top

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews