Skip to content

Commit 9f24fa0

Browse files
committed
improvement: support positional name argument in generate_migrations
closes #209
1 parent a5f457e commit 9f24fa0

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

lib/mix/tasks/ash_sqlite.generate_migrations.ex

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,18 @@ defmodule Mix.Tasks.AshSqlite.GenerateMigrations do
9292

9393
@shortdoc "Generates migrations, and stores a snapshot of your resources"
9494
def run(args) do
95+
{name, args} =
96+
case args do
97+
["-" <> _ | _] ->
98+
{nil, args}
99+
100+
[first | rest] ->
101+
{first, rest}
102+
103+
[] ->
104+
{nil, []}
105+
end
106+
95107
{opts, _, _} =
96108
OptionParser.parse(args,
97109
strict: [
@@ -122,6 +134,7 @@ defmodule Mix.Tasks.AshSqlite.GenerateMigrations do
122134
opts
123135
|> Keyword.put(:format, !opts[:no_format])
124136
|> Keyword.delete(:no_format)
137+
|> Keyword.put_new(:name, name)
125138

126139
AshSqlite.MigrationGenerator.generate(domains, opts)
127140
end

0 commit comments

Comments
 (0)