summaryrefslogtreecommitdiffstats
path: root/erlang-find-provides.escript
blob: 44333375cc3acb5357b7f5f80d747b6cf33e41c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/escript
%% -*- erlang -*-

main(EbinFiles) ->
	lists:foreach(
		fun(BeamFile) ->
			try
				{ok, {Module, [{exports,Exports}]}} = beam_lib:chunks(BeamFile, [exports]),
				case Module of
					eunit_test -> io:format ("erlang(eunit_test:nonexisting_function/0)~n");
					wx -> io:format ("erlang(demo:start/0)~n");
					_ -> ok
				end,
				lists:foreach( fun({ModFun,Arity})->io:format("erlang(~p:~s/~p)~n", [Module, ModFun,Arity]) end, Exports)
			catch
				_:_ ->
					ok
			end
		end,
		EbinFiles);

main(_) ->
	halt(1).