-
Notifications
You must be signed in to change notification settings - Fork 518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add command rebar3 alias #2825
Add command rebar3 alias #2825
Conversation
What do you think of something like: Aliases = rebar_state:get(State, alias, []),
{{ok, NewState}, Created} = lists:foldl(fun({Alias, Cmds}, {{ok, StateAcc}, CreatedAliases}) ->
case validate_provider(Alias, Cmds, State) of
true -> {init_alias(Alias, Cmds, StateAcc), [{Alias, Cmds}|CreatedAliases]};
false -> {{ok, State}, CreatedAliases}
end
end, {{ok, State}, []}, Aliases),
{ok, rebar_state:set(NewState, '_created_aliases', Created)} though maybe written with a bit more readability? |
Oh, that might be the missing piece. I'll try it out. I was reading through |
`rebar3 alias` will list your rebar.config -defined aliases as e.g: static=eunit,dialyzer doc=compile,ex_doc ci=eunit,ct --verbose,cover just like zsh's alias would, for example
I'm gonna amend the last commit, since implementation was completely re-done, and I don't think it worth it to keep that bit of history (since it was an experiment). Thank you, @ferd, you really helped simplify the solution. Edit: I'm ✅ing "a better solution". |
52ee5b8
to
20f348b
Compare
While looking at the tests, I found e.g.
Is anything picking this up for output, or is it just "internal" documentation? It'd be neat to use elsewhere (been searching for a mechanism like this, that could integrate with CT). |
a) it might be nice to namespace the config value ('_rebar_prv_alias_created_aliases') to avoid accidentally trampling over anything b) that practice with |
a) 👍 |
I've added a simple test (6c20c5a) that validates the output of I'm ✅ing "tests". |
Documentation for the command has been proposed by tsloughter/rebar3.org#121. I'm ✅ing "rebar3.org companion update". |
@ferd, I'd had a failure similar to https://github.com/erlang/rebar3/actions/runs/5985193071/job/16237059158?pr=2825#step:5:37 in the past (my |
yeah, re-running the tests, that's a weird race. |
Nice! Thanks for the contrib, going to merge the doc one too. |
Closes #2824 (pushed mostly to start the discussion around it).
What's missing?
You can see I work a lot with substrings 😄 Basically, this is because I don't see a way to save what I want in the state, and
providers
doesn't provide 😄 for a way to save state in the provider either (if, e.g., it had a "meta" or "extra" element we could pass info. around that'd remain internal). I initially was going to use theshort_desc
field, but there's no accessor there either. Maybe I'll even have to updateproviders
first (depending on guidance) before I move forward.As is, though, this is functional, albeit "quick and dirty".