문제

I want use erl_tidy to format erlang code, including escript files. But this comes out when I format one escript file (source) after adding -module(erl_pprint). :

1> erl_tidy:file("erl_pprint").
erl_pprint: error: cannot determine module name.
** exception exit: error

But When I remove the she-bang line #!/usr/bin/env escript, formatting goes well. So how can I formatteing the code while keep the she-bang line?

도움이 되었습니까?

해결책

You can't treat an escript file as a normal module and give it to erl_tidy. Perhaps you can drop the comment lines using "tail -n+2 erl_pprint > /tmp/erl_pprint.erl", run erl_tidy on the temp file, and then use "cat escript-header.txt /tmp/erl_pprint.erl > erl_pprint.new", if you create a file called escript-header.txt containing the leading shebang line (or lines).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top