%%% %%% Copyright (c) 2017, Klarna AB %%% %%% Licensed under the Apache License, Version 2.0 (the "License"); %%% you may not use this file except in compliance with the License. %%% You may obtain a copy of the License at %%% %%% http://www.apache.org/licenses/LICENSE-2.0 %%% %%% Unless required by applicable law or agreed to in writing, software %%% distributed under the License is distributed on an "AS IS" BASIS, %%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %%% See the License for the specific language governing permissions and %%% limitations under the License. %%% -module(brod_cli). -ifdef(BROD_CLI). -export([main/2]). -include("brod_int.hrl"). -define(CLIENT, brod_cli_client). -define(MAIN_DOC, "usage: brod -h|--help brod -v|--version brod [options] [-h|--help] [--verbose|--debug] commands: meta: Inspect topic metadata offset: Inspect offsets fetch: Fetch messages send: Produce messages pipe: Pipe file or stdin as messages to kafka groups: List or describe consumer group commits: List consumer group offset commits "). %% NOTE: bad indentation at the first line is intended -define(COMMAND_COMMON_OPTIONS, " --ssl Use TLS, validate server using trusted CAs --cacertfile= Use TLS, validate server using the given certificate --certfile= Client certificate in case client authentication is enabled in borkers --keyfile= Client private key in case client authentication is enabled in borkers --sasl-plain= Tell brod to use username/password stored in the given file, the file should have username and password in two lines. --ebin-paths= Comma separated directory names for extra beams, This is to support user compiled message formatters " ). -define(META_CMD, "meta"). -define(META_DOC, "usage: brod meta [options] options: -b,--brokers= Comma separated host:port pairs [default: localhost:9092] -t,--topic= Topic name [default: *] -T,--text Print metadata as aligned texts (default) -J,--json Print metadata as JSON object -L,--list List topics, no partition details, Applicable only for --text option -U,--under-replicated Display only under-replicated partitions " ?COMMAND_COMMON_OPTIONS "Text output schema (out of sync replicas are marked with *): brokers : : topics : : [[ERROR] []] : (replicas[*]...) [] " ). -define(OFFSET_CMD, "offset"). -define(OFFSET_DOC, "usage: brod offset [options] options: -b,--brokers= Comma separated host:port pairs [default: localhost:9092] -t,--topic= Topic name -p,--partition= Partition number -T,--time=