ninenines / erlang.mk

A build tool for Erlang that just works.
https://erlang.mk
ISC License
578 stars 241 forks source link

Feature: Additional template modifiers #970

Open artman41 opened 1 year ago

artman41 commented 1 year ago

Currently, we're limited to templates that will create files under either src/ or $app/src/

I think it'd be useful if templates could have a defined relative path and file extension so that we could create hrl templates & test templates.

e.g

Template

tpl_hrl_dir = include/
tpl_hrl_ext = .hrl
define tpl_hrl
-ifndef(HRL_$(n)).
-define(HRL_$(n), 1).

-endif.
endef

Execution

make new t=hrl n=my_file

include/my_file.hrl

-ifndef(HRL_my_file).
-define(HRL_my_file, 1).

-endif.
essen commented 1 year ago

That's a good idea. Not sure about how it should be implemented but patch is welcome!