Skip to content

Commit

Permalink
Pass :strict option to OptionParser.parse/2 (#647)
Browse files Browse the repository at this point in the history
Removes Elixir deprecation warning when calling `Mix.Tasks.Absinthe.Schema.Json.run/1`.
  • Loading branch information
redrabbit authored and benwilson512 committed Dec 13, 2018
1 parent f1d76e5 commit d34d5ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/mix/tasks/absinthe.schema.json.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ defmodule Mix.Tasks.Absinthe.Schema.Json do
Mix.Task.run("loadpaths", argv)
Mix.Project.compile(argv)

{opts, args, _} = OptionParser.parse(argv)
{opts, args, _} = OptionParser.parse(argv, strict: [schema: :string, json_codec: :string, pretty: :boolean])

schema = find_schema(opts)
json_codec = find_json(opts)
Expand All @@ -80,14 +80,14 @@ defmodule Mix.Tasks.Absinthe.Schema.Json do
end

defp codec_opts(codec, opts) when codec in [Poison, Jason] do
codec_pretty_opt(Keyword.get(opts, :pretty, "false"))
codec_pretty_opt(Keyword.get(opts, :pretty, false))
end

defp codec_opts(_, _) do
[]
end

defp codec_pretty_opt("true"), do: [pretty: true]
defp codec_pretty_opt(true), do: [pretty: true]
defp codec_pretty_opt(_), do: []

defp find_schema(opts) do
Expand Down

0 comments on commit d34d5ab

Please sign in to comment.