SvExNew.Options (sv_ex_new v0.2.0)

Copy Markdown

The mix sv_ex.new argv contract.

Illegal combinations are unrepresentable: parse!/1 either returns a fully populated struct or raises. There are no defaults for --base or --github-org — a silent default here would silently generate the wrong project.

Summary

Functions

The dependency line to splice into the generated project's deps/0.

The Mix task that generates this base's stock project.

The argv to hand the generator.

Parses argv into a fully validated %SvExNew.Options{}.

Types

base()

@type base() :: :otp | :api | :web

dep_source()

@type dep_source() :: {:hex, String.t()} | {:path, Path.t()}

t()

@type t() :: %SvExNew.Options{
  app: atom(),
  base: base(),
  github_org: String.t(),
  module: module(),
  name: String.t(),
  sv_ex: dep_source()
}

Functions

dep_line(options)

@spec dep_line(t()) :: binary()

The dependency line to splice into the generated project's deps/0.

generator(options)

@spec generator(t()) :: String.t()

The Mix task that generates this base's stock project.

generator_argv(opts)

@spec generator_argv(t()) :: [String.t()]

The argv to hand the generator.

:web and :api produce the SAME stock tree, and that is not an oversight: priv/baselines.exs records :web as derived_from: :api plus the :web_layer plugin, so the asset pipeline arrives when that plugin is applied and never from phx.new. Generating :web with HTML and assets here would hand the plugin a tree it did not derive against.

parse!(argv)

@spec parse!([String.t()]) :: t()

Parses argv into a fully validated %SvExNew.Options{}.