rebar3 icon indicating copy to clipboard operation
rebar3 copied to clipboard

Add user_default module and have some shell commands

Open pouriya opened this issue 5 years ago • 3 comments

rebar3 shell will have new commands for example compile(), version(), tree() etc.

pouriya@codefather /p/rebar3 $ ./rebar3 shell
===> Verifying dependencies...
===> Compiling rebar
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [kernel-poll:false]
Eshell V9.3  (abort with ^G)
1> v().
rebar 0.0.0+build.2.ref26f12dc on Erlang/OTP 20 Erts 9.3
ok
2> version().
rebar 0.0.0+build.2.ref26f12dc on Erlang/OTP 20 Erts 9.3
ok
3> path().
/p/rebar3/_build/default/lib/ssl_verify_fun/ebin /p/rebar3/_build/default/lib/relx/ebin /p/rebar3/_build/default/lib/providers/ebin /p/rebar3/_build/default/lib/getopt/ebin /p/rebar3/_build/default/lib/eunit_formatters/ebin /p/rebar3/_build/default/lib/erlware_commons/ebin /p/rebar3/_build/default/lib/cth_readable/ebin /p/rebar3/_build/default/lib/cf/ebin /p/rebar3/_build/default/lib/certifi/ebin /p/rebar3/_build/default/lib/bbmustache/ebin /p/rebar3/_build/default/lib/rebar/ebinok
4> tree().
Verifying dependencies...
└─ rebar─0.0.0+build.2.ref26f12dc (project app)
   ├─ bbmustache─1.5.0 (hex package)
   ├─ certifi─2.0.0 (hex package)
   ├─ cf─0.2.2 (hex package)
   ├─ cth_readable─1.4.2 (hex package)
   ├─ erlware_commons─1.2.0 (hex package)
   ├─ eunit_formatters─0.5.0 (hex package)
   ├─ getopt─1.0.1 (hex package)
   ├─ providers─1.7.0 (hex package)
   ├─ relx─3.26.0 (hex package)
   └─ ssl_verify_fun─1.1.3 (hex package)
ok
5> c().
Verifying dependencies...
Compiling rebar
ok
6> compile().
Verifying dependencies...
Compiling rebar
ok

pouriya avatar Jul 26 '18 16:07 pouriya

Because Erlang can only load one module of a given name at a time, this risks preventing users from defining or using their own user_default files. I don't think it's a good idea to break possibly pre-existing unrelated tools people have. Instead, I would advise that you add that file (or shell_default)to your local install or use the .erlang file.

ferd avatar Jul 26 '18 18:07 ferd

I was thinking we could either include it in priv like the bash/zsh completitions or put it on rebar3.org.

tsloughter avatar Jul 26 '18 18:07 tsloughter

Actually I tested it. rebar3 shell loads my user_default instead of its own user_default. code:get_path shows that my user_default will be loaded first.

pouriya avatar Jul 26 '18 18:07 pouriya