Skip to content

Commit

Permalink
chore(cli): cli support include_dirs options
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongwencool committed Oct 15, 2021
1 parent ec7e630 commit a6c0851
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/hocon_cli.erl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ cli_options() ->
[
{help, $h, "help", undefined, "Print this usage page"}
, {dest_dir, $d, "dest_dir", string, "specifies the directory to write the config file to"}
, {include_dirs, $I, "include_dir", string, "specifies the directory to search include file"}
, {dest_file, $f, "dest_file", {string, "app"}, "the file name to write"}
, {schema_file, $i, "schema_file", string, "the file name of schema module"}
, {schema_module, $s, "schema_module", atom, "the name of schema module"}
Expand Down Expand Up @@ -177,8 +178,9 @@ load_schema(ParsedArgs) ->
-spec load_conf([proplists:property()], function()) -> hocon:config() | no_return().
load_conf(ParsedArgs, LogFunc) ->
ConfFiles = proplists:get_all_values(conf_file, ParsedArgs),
LogFunc(debug, "ConfFiles: ~0p", [ConfFiles]),
case hocon:files(ConfFiles, #{format => richmap}) of
IncDirs = proplists:get_all_values(include_dirs, ParsedArgs),
LogFunc(debug, "ConfFiles: ~0p", [{ConfFiles, IncDirs}]),
case hocon:files(ConfFiles, #{format => richmap, include_dirs => IncDirs}) of
{error, E} ->
LogFunc(error, "~0p~n", [E]),
stop_deactivate();
Expand Down

0 comments on commit a6c0851

Please sign in to comment.