Skip to content

Commit

Permalink
Merge pull request #2 from sleipnir/feat/repetable-plugin-option
Browse files Browse the repository at this point in the history
Use singular in plugin option
  • Loading branch information
drowzy authored Mar 28, 2024
2 parents f470494 + 246dc02 commit f3bce60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/mix/protobuf.generate.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defmodule Mix.Tasks.Protobuf.Generate do
* `--generate-descriptors` - Includes raw descriptors in the generated modules
* `--one-file-per-module` - Changes the way files are generated into directories. This option creates a file for each generated Elixir module.
* `--include-documentation` - Controls visibility of documentation of the generated modules. Setting `true` will not have `@moduleoc false`
* `--plugins` - If you write services in protobuf, you can generate gRPC code by passing `--plugins=grpc`.
* `--plugin` - If you write services in protobuf, you can generate gRPC code by passing `--plugin=grpc`.
## Examples
Expand All @@ -29,7 +29,7 @@ defmodule Mix.Tasks.Protobuf.Generate do
--include-path=deps/googleapis \
--generate-descriptors=true \
--output-path=./lib \
--plugins=ProtobufGenerate.Plugins.GRPC
--plugin=ProtobufGenerate.Plugins.GRPC
google/api/annotations.proto google/api/http.proto helloworld.proto
"""
Expand All @@ -49,14 +49,14 @@ defmodule Mix.Tasks.Protobuf.Generate do
transform_module: :string,
include_docs: :boolean,
one_file_per_module: :boolean,
plugins: :keep
plugin: :keep
]

@impl Mix.Task
@spec run(any) :: any
def run(args) do
{opts, files} = OptionParser.parse!(args, strict: @switches)
{plugins, opts} = pop_values(opts, :plugins)
{plugins, opts} = pop_values(opts, :plugin)
{imports, opts} = pop_values(opts, :include_path)

transform_module =
Expand Down
2 changes: 1 addition & 1 deletion test/mix/tasks/protobuf.generate_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ defmodule Mix.Tasks.Protobuf.GenerateTest do
"--include-path=#{tmp_dir}",
"--include-path=#{Mix.Project.deps_paths().google_protobuf}/src",
"--output-path=#{tmp_dir}",
"--plugins=ProtobufGenerate.Plugins.GRPC",
"--plugin=ProtobufGenerate.Plugins.GRPC",
proto_path
])

Expand Down

0 comments on commit f3bce60

Please sign in to comment.