An interactive erlang console

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

An interactive erlang console

ARUN P

Hi,

I am working on an erlang application which provides a command line tool to run some basic tests on hardware. The tool work like this,
as the application starts, it will prompt a message on the console, user can give any options present in the console, based on the options
provided by user the application performs the required tests.

I am using io:read/1, functions to display the message and read the user provided options. But the problem with this function is that, user has to give a
dot at the end. Is it possible to avoid forcing user to put dot at the end of every option he provides, any better function or is there any better way build
a command line tool in erlang.

Can someone please help me out in this.

Thanks and regards,
Arun

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: An interactive erlang console

A. G. Madi
Hi Arun,

I write a lot of CLI tools using Erlang so I created some escript boilerplate code that I use for this.  You can find it at https://github.com/WarpEngineer/escript_boilerplate 
Maybe you can use it to build your tool or maybe it'll give you some ideas on setting it up the way you like it.  


On Monday, February 19, 2018 9:34 PM, Arun <[hidden email]> wrote:


Hi,
I am working on an erlang application which provides a command line tool to run some basic tests on hardware. The tool work like this,
as the application starts, it will prompt a message on the console, user can give any options present in the console, based on the options
provided by user the application performs the required tests.

I am using io:read/1, functions to display the message and read the user provided options. But the problem with this function is that, user has to give a
dot at the end. Is it possible to avoid forcing user to put dot at the end of every option he provides, any better function or is there any better way build
a command line tool in erlang.

Can someone please help me out in this.

Thanks and regards,
Arun
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: An interactive erlang console

bengt e
In reply to this post by ARUN P
Greetings,

Can you provide some additional information?
There are other functions in the IO module, e.g. fread/2or get_line/1, that do not need a ‘.’. Have you tried these? Why are they not a good fit?


Best Wishes,
bengt

On 20 Feb 2018, at 04:34, Arun <[hidden email]> wrote:

Hi,

I am working on an erlang application which provides a command line tool to run some basic tests on hardware. The tool work like this,
as the application starts, it will prompt a message on the console, user can give any options present in the console, based on the options
provided by user the application performs the required tests.

I am using io:read/1, functions to display the message and read the user provided options. But the problem with this function is that, user has to give a
dot at the end. Is it possible to avoid forcing user to put dot at the end of every option he provides, any better function or is there any better way build
a command line tool in erlang.

Can someone please help me out in this.

Thanks and regards,
Arun
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: An interactive erlang console

Joe Armstrong-2
In reply to this post by ARUN P
$ erl
1> io:get_line('Name > ').
Name > Joe with no dot
"Joe with no dot\n"

/Joe

On Tue, Feb 20, 2018 at 4:34 AM, Arun <[hidden email]> wrote:

> Hi,
>
> I am working on an erlang application which provides a command line tool to
> run some basic tests on hardware. The tool work like this,
> as the application starts, it will prompt a message on the console, user can
> give any options present in the console, based on the options
> provided by user the application performs the required tests.
>
> I am using io:read/1, functions to display the message and read the user
> provided options. But the problem with this function is that, user has to
> give a
> dot at the end. Is it possible to avoid forcing user to put dot at the end
> of every option he provides, any better function or is there any better way
> build
> a command line tool in erlang.
>
> Can someone please help me out in this.
>
> Thanks and regards,
> Arun
>
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions
>
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions