wolfadex / elm-open-api-cli

A CLI tool for generating Elm modules from Open API specs.
https://www.npmjs.com/package/elm-open-api
25 stars 6 forks source link

Improve type CLI arg to better support future types/packages #110

Closed wolfadex closed 3 months ago

wolfadex commented 3 months ago
          Would this differ at all between someone wanting to use `avh4/elm-program-test` and `lamdera/program-test`? I think so but want to make sure. Asking because I'm wondering if the effect type should be the full package name. Something like
elm/http.cmd
elm/http.cmdrisky
elm/http.task
elm/http.taskrisky
dillonkearns/elm-pages.backendtask
lamdera/program-test.programtest
lamdera/program-test.programtesttask

those are verbose, but also more clear as to where they're coming from, especially if we added say avh4/elm-program-test because it'd be more difficult to tell that apart from the Lamdera one.

Would love to get your thoughts

_Originally posted by @wolfadex in https://github.com/wolfadex/elm-open-api-cli/pull/108#discussion_r1672625207_

miniBill commented 3 months ago

Alternatively:

--types: a list of (cmd | task | cmdrisky | taskrisky) --packages: a list of (elm/http | lamdera/program-test | dillonkearns/elm-pages | avh4/elm-program-test | andrewMacmurray/elm-concurrent-task) - if empty use [elm/http]

miniBill commented 3 months ago

Alternatively², for --effect-types:

cmd
cmd-risky
task
task-risky
dillonkearns/elm-pages [this produces BackendTask]
lamdera/program-test [this produces both Command and Effect.Task]
avh4/elm-program-test
miniBill commented 3 months ago

Alternatively³: --effect-types: a list of [package].[type], where type defaults to "all of them" and package defaults to elm/http.

So cmd is elm/http.cmd, dillonkearns/elm-pages is everything from elm-pages, lamdera/program-test.task are just the tasks from lamdera/program-test, etc

This is retrocompatible and flexible yet simply usable

wolfadex commented 3 months ago

I'm liking option 3 the most right now. It's the most flexible & most explicit, and explicit feels the most Elm-like.

miniBill commented 3 months ago

The only hard part is writing a nice help message for it :D