An easy way to save the result/session to a file would be nice. Something like \o
in psql
. Useful when debugging a system, when evidence/state needs to be collected quickly for later analysis.
There are two separate streams of output coming to the shell:
- The commands your type and what they return
- Things printed by
io:format
in the application
Do you have any suggestions about which streams should be part of the log? if configurable, what should be the default?
Another useful feature in the same area would be for -remsh
to be able to store a log of the current session at both the remote and local node.
I donāt recall having to redirect io:format
stream, so personally, Iād probably default to capturing the commands I type and what they return. Of course there could be other uses cases.
Re Home/End:
Ctrl+A / Ctrl+E serves that purpose, no?
I also found that Option + Left/Right arrow skips over words. Remembering all these tricks is my difficulty.
It does yes, butā¦
Itās easier to remember when they are standard Mac shortcuts - CMD+left/right usually jump to the beginning end of line with Option+left/right skipping words in most text editing apps, just as Mail, Notes, TextMate, TextEdit etc. (Itās good that Option+left/right does the same as Ctrl+A / Ctrl+E so itās a bit easier to remember, or remember once you try CMD+left/right and see that it does not work )
Another useful feature might be to be able to have a custom pluggable formatter of the output printed in the shell. E.g. if one wanted to modify the way how textual binaries are printed from <<"...">>
to something like āā¦ā, it would be easily achievable with a plugin.
A couple of years ago we experimented with allowing custom formatters to be able to display things such as dict
and array
in a more human-readable format. I donāt recall exactly the reason why that effort was dropped, but I think it had something to do with the performance of printing and depth-limiting of printed terms. Maybe @kennethL remembers more?
@frazze just opened a new PR for better autocompletion in the Erlang shell. Please have a look and put any feedback in the PR. Some quick example code:
> erl
Erlang/OTP 25 [RELEASE CANDIDATE 2] [erts-12.3] [source-b4c62d6ccd] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]
Eshell V12.3 (abort with ^G)
1> lists:foldl(<TAB>
fun(Elem :: term(), term() -> term())
1> lists:foldl(fun(A, Acc) -> A + Acc end, <TAB>
term()
1> lists:foldl(fun(A, Acc) -> A + Acc end, 0, <TAB>
[term()]
1> lists:foldl(fun(A, Acc) -> A + Acc end, 0, [1,2,3]).
6
2> file:open("lib/<TAB>
.. .gitignore Makefile TAGS
asn1 common_test compiler crypto
debugger dialyzer diameter edoc
eldap erl_docgen erl_interface et
eunit ftp inets jinterface
kernel megaco mnesia observer
odbc os_mon parsetools public_key
reltool runtime_tools sasl snmp
ssh ssl stdlib syntax_tools
tftp tools wx xmerl
2> file:open("lib/std<TAB>
2> file:open("lib/stdlib/
2> file:open("lib/stdlib/src/so<TAB>
2> file:open("lib/stdlib/src/sofs.erl"
2> file:open("lib/stdlib/src/sofs.erl").
{ok, D}
It is a work in progress, so keep that in mind when looking at the PR. I think it is a great start at better auto completion.
It would be nice to add console functionality to the Erlang documentation.
I have seen how it nice work in the Rust programming language documentation. I love it.
Two
Three
Something similar has already been tried.
Here is a description of such an attempt.
Try Erlang online supplement to the book āErlang Programmingā https://www.tryerlang.org/ - educational online supplement to the book āErlang Programmingā. It is implemented as a console, emulating the behavior of erl/werl consoles.
The application is multifunctional: it is a tutorial, the behavior of which can be controlled by following the instructions described under the console window. You can jump to the previous or next section by entering the prev commands. and nextā¦ is the console that allows you to run the bookās examples. is a console that allows you to see the results of many functions
- Try Erlang. This web application is developed using the back-end (Erlang) - Webmachine GitHub - basho/webmachine: A REST-based system for building web applications.,
- front-end jQuery (jQuery Console Plugin, jQuery ProgressBar Plugin).
About numerous hacker attacks and protection against them, the author of this project shared on the pages of his blog - More details in the article Try Erlang | VK.
This application was implemented under the influence of the https://tryhaskell.org/ project.
Awesome
Fantastic. Even just the completion of currently-bound variables is quite a game-changer.
Are you just extending the āoldā edlin_expand
API? Would be very nice for me as it would automatically carry over to my Jupyter kernel implementation
The one thing that amazes me more than that people can work on those tiny keyboards is that there are people who want to do just that. I mean, why do people who sit in front of screens whose size often dwarfes a cinema like to type on those flimsy things that are stripped of some of the most crucial keys, or cram them in the most awkward of places
Just joking
Anyway, I have seen many people requesting all sorts of keyboard shortcuts. As different (OS-ish) shells have different shortcuts for different things, finding a common, one-size-fits-all setup will be difficult, so I think those should be configurable and come with reasonable defaults depending on the shell and/or OS where they are used. (But I wonāt need many of those anyway, since Iām using a proper, full-size keyboard )
Apart from that, yes, syntax coloring would be nice, maybe with nested brackets in different, corresponding colors.
Oh, and a quick and easy way to turn output truncation on and off. The shell has a habit of cutting off and going all ellipsis just before the point where it gets interesting. There probably is a way to do that right now, but I can never remember when I need it and canāt be bothered to look it up, so I usually turn to io:format
As a non american I can also add different keyboard layouts to the mix of reasons for āone size fits allā being problematic
Yes, but I have to read a map with variable bindings and an ets table with the loaded records and their types. How we load records might change though, weāre thinking of maybe loading the records dynamically as you need them in your prompt.
For example if mod:fun expects a #some_record, then we can look it up and display the contents of the #some_record
mod:fun(#some_record{
But if you would just type the record in isolation, the shell would not know where #some_record lives and in that case you would need to load them with rr(), and provide that table to edlin_expand
#some_record{<tab
One of the nice things about using the readline library proposed above in this thread is that it already has solved the problem of different key-bindings for different OSs. But alas it seems like we cannot use it.
On the other hand, I quite like that Erlang has the same key binding no matter if I am on windows, macos or Linux. But I think Iām rather unique in using erlang on all of those platforms almost every day.
I use the shell built in function rp/1
. I.e. rp(v(-1))
. However, adding a command line shortcut to gradually increase the depths of the previously returned term could be very neat.
I think there are two main reasonsā¦ ergonomics (low profile and mouse not too far away) and wanting to keep your desktop keyboard as close as possible to your laptop keyboard to make switching as effortless as possible
If they are using platform-dependent keys (so the Command key on the Mac) then I think it may be ok? I agree it could be a nightmare trying to find common ground for shared keys like Control and Alt
Have you thought about adding FreeBSD to that mix too Lukas!?
(Iād still be curious to learn what, if any, advantages there are using FreeBSD with Erlang if anyoneās reading this who might know!)
I did have freebsd on my home server before, but Iāve yet to start it up since my last move. And from the perspective of shells, all OSs behave basically the same except MacOS and Windows.
Heh Reminds me, when I was a kid, my father brought home some russian model ācomputerā that he got second hand. It had a tiny ākeyboardā set in a wooden frame, with 4 ALT keys to access the 4 layers of symbols imposed on each keyā¦ Those were the days