Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/.gitlint
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ ignore=title-trailing-punctuation, T1, T2, T3, T4, T5, T6, T8, B1, B2, B3, B4, B
# python-style regex that the commit-msg title must match
# Note that the regex can contradict with other rules if not used correctly
# (e.g. title-must-not-contain-word).
regex=^(ci|feat|fix|docs|style|refactor|test|chore|perf)(\(.+\))?: .+
regex=^(build|ci|feat|fix|docs|style|refactor|test|chore|perf)(\(.+\))?: .+

# [body-max-line-length]
# line-length=72
Expand Down
16 changes: 6 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
REBAR := $(CURDIR)/rebar3
REBAR := rebar3

.PHONY: all
all: es

$(REBAR):
@curl -k -f -L "https://github.com/emqx/rebar3/releases/download/3.19.0-emqx-6/rebar3" -o ./rebar3
@chmod +x ./rebar3

.PHONY: compile
compile: $(REBAR)
compile:
$(REBAR) compile

.PHONY: clean
clean: distclean

.PHONY: distclean
distclean:
@rm -rf rebar3 _build erl_crash.dump rebar3.crashdump src/hocon_parser.erl src/hocon_scanner.erl
@rm -rf _build erl_crash.dump rebar3.crashdump src/hocon_parser.erl src/hocon_scanner.erl

.PHONY: xref
xref:
Expand All @@ -40,7 +36,7 @@ dialyzer: compile

.PHONY: es
es: export HOCON_ESCRIPT = true
es: $(REBAR)
es:
$(REBAR) as es escriptize

.PHONY: elvis
Expand All @@ -49,9 +45,9 @@ elvis:

.PHONY: fmt erlfmt
fmt: erlfmt
erlfmt: $(REBAR)
erlfmt:
$(REBAR) fmt -w

.PHONY: erlfmt-check
erlfmt-check: $(REBAR)
erlfmt-check:
$(REBAR) fmt -c
13 changes: 8 additions & 5 deletions src/hocon_maps.erl
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,17 @@ get(Path, Config, Default) ->
V -> V
end.

%% @doc get a child node from richmap, return value also a richmap.
%% `undefined' is returned if no value path.
%% Key (first arg) can be "foo.bar.baz" or ["foo.bar", "baz"] or ["foo", "bar", "baz"].
-spec deep_get(name() | [name()], config()) -> config() | undefined.
%% @doc Get a child node from richmap, return value may also be a richmap.
%% `undefined' is returned if no value found for the path.
%% `Path' can be `"foo.bar.baz"', `["foo.bar", "baz"]' or `["foo", "bar", "baz"]'.
-spec deep_get(name() | [name()], config()) -> term().
deep_get(Path, Conf) ->
deep_get(Path, Conf, richmap).

-spec deep_get(name() | [name()], config(), richmap | map) -> config() | undefined.
%% @doc Get a child node from map | richmap, return value may also be a map | richmap.
%% `undefined' is returned if no value found for the path.
%% `Path' can be `"foo.bar.baz"', `["foo.bar", "baz"]' or `["foo", "bar", "baz"]'.
-spec deep_get(name() | [name()], config(), richmap | map) -> term().
deep_get(Path, Conf, Format) ->
do_get(hocon_util:split_path(Path), Conf, Format).

Expand Down