diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2015-03-07 01:06:59 -0500 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2015-03-07 01:06:59 -0500 |
commit | fe6ad4dde18b592659bcf4b71aa1c19e9fa188de (patch) | |
tree | c077fd6b057705d42a1f94ed4ed15ad278de69d9 /src | |
parent | 11840e308341874c79bd860ba8bcd126e224ce49 (diff) | |
parent | ba79fc082334574f4ff0f543615e041cbd1d6a17 (diff) |
Merge pull request #239 from talentdeficit/as_comma_then_space
parse `rebar3 as foo, bar task` correctly
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_prv_as.erl | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/rebar_prv_as.erl b/src/rebar_prv_as.erl index 7ac5465..beee00d 100644 --- a/src/rebar_prv_as.erl +++ b/src/rebar_prv_as.erl @@ -51,19 +51,23 @@ args_to_profiles_and_tasks(Args) -> first_profile([]) -> {[], []}; first_profile([ProfileList|Rest]) -> case re:split(ProfileList, ",", [{return, list}, {parts, 2}]) of - %% profile terminated by comma - [P, More] -> profiles([More] ++ Rest, [P]); - %% profile not terminated by comma - [P] -> comma_or_end(Rest, [P]) + %% `foo, bar` + [P, ""] -> profiles(Rest, [P]); + %% `foo,bar` + [P, More] -> profiles([More] ++ Rest, [P]); + %% `foo` + [P] -> comma_or_end(Rest, [P]) end. profiles([], Acc) -> {lists:reverse(Acc), rebar_utils:args_to_tasks([])}; profiles([ProfileList|Rest], Acc) -> case re:split(ProfileList, ",", [{return, list}, {parts, 2}]) of - %% profile terminated by comma - [P, More] -> profiles([More] ++ Rest, [P|Acc]); - %% profile not terminated by comma - [P] -> comma_or_end(Rest, [P|Acc]) + %% `foo, bar` + [P, ""] -> profiles(Rest, [P|Acc]); + %% `foo,bar` + [P, More] -> profiles([More] ++ Rest, [P|Acc]); + %% `foo` + [P] -> comma_or_end(Rest, [P|Acc]) end. %% `, foo...` |