Menu-driven Console Application in Ruby

Discussion in 'Ruby' started by Joe Martin, Feb 22, 2010.

  1. Joe Martin

    Joe Martin Guest

    Hello
    I'm trying to create a console application with ruby on Windows. I wish
    to have it menu driven, so each screen the user sees is essentially a
    menu, where the user can enter a number (representing their menu
    choice), such as:

    -----------------------------
    Welcome to my application!

    Menu
    1. Perform some action
    2. View option list
    3. Exit application

    Enter selection> _
    -----------------------------

    Really I'm looking for skeleton or sample code for a console
    application. A few google searches did return skeleton code for a
    command-line and console applications, but everything I found was more
    geared towards command line applications (that is, skeleton code for
    parsing out parameters, proper help syntax, etc), and not creating a
    menu-driven environment.

    I already have the program basically written out and working, but it's
    very hacky with many if-else and when-case checks, so I'm hoping that it
    could be structured and written out in a cleaner fashion--just not quite
    sure where to start, and I'm out of ideas on what other ways (or other
    libraries) are viable options for me. The menus of this application wil
    be multiple levels deep, so that needs to be kept in mind as well.

    Any ideas on where to start? I'm willing to start the application from
    scratch if the end result is cleaner, more standard code.
    --
    Posted via http://www.ruby-forum.com/.
     
    Joe Martin, Feb 22, 2010
    #1
    1. Advertising

  2. [Note: parts of this message were removed to make it a legal post.]

    On Mon, Feb 22, 2010 at 3:38 PM, Joe Martin <>wrote:

    > Hello
    > I'm trying to create a console application with ruby on Windows. I wish
    > to have it menu driven, so each screen the user sees is essentially a
    > menu, where the user can enter a number (representing their menu
    > choice), such as:
    >
    >


    You should look at the ncurses gem/project.
    http://rbcurse.rubyforge.org/

    <http://rbcurse.rubyforge.org/>You will probably need to do a bit of
    googling for tutorials and such

    --
    http://richardconroy.blogspot.com
     
    Richard Conroy, Feb 22, 2010
    #2
    1. Advertising

  3. Joe Martin

    ghorner Guest

    On Feb 22, 10:38 am, Joe Martin <> wrote:
    > Hello
    > I'm trying to create a console application with ruby on Windows.  I wish
    > to have it menu driven, so each screen the user sees is essentially a
    > menu, where the user can enter a number (representing their menu
    > choice), such as:
    >
    > -----------------------------
    > Welcome to my application!
    >
    > Menu
    > 1. Perform some action
    > 2. View option list
    > 3. Exit application
    >
    > Enter selection> _
    > -----------------------------
    >
    > Really I'm looking for skeleton or sample code for a console
    > application.  A few google searches did return skeleton code for a
    > command-line and console applications, but everything I found was more
    > geared towards command line applications (that is, skeleton code for
    > parsing out parameters, proper help syntax, etc), and not creating a
    > menu-driven environment.
    >
    > I already have the program basically written out and working, but it's
    > very hacky with many if-else and when-case checks, so I'm hoping that it
    > could be structured and written out in a cleaner fashion--just not quite
    > sure where to start, and I'm out of ideas on what other ways (or other
    > libraries) are viable options for me.  The menus of this application wil
    > be multiple levels deep, so that needs to be kept in mind as well.
    >
    > Any ideas on where to start?  I'm willing to start the application from
    > scratch if the end result is cleaner, more standard code.


    Highline, http://highline.rubyforge.org/, has a pretty good menu
    widget: http://highline.rubyforge.org/doc/classes/HighLine/Menu.html
    Hirb , http://github.com/cldwalker/hirb, also has a decent one:
    http://tagaholic.me/2010/02/16/two-dimensional-console-menus-with-hirb.html

    Neither one of these requires using curses which may be a good thing
    being in windows.
    I don't think either one of these supports multiple levels.
     
    ghorner, Feb 22, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brent Burkart

    database driven menu

    Brent Burkart, Jan 27, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,436
    Brent Burkart
    Jan 29, 2004
  2. Paul

    Data driven menu problem

    Paul, Apr 5, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    362
  3. F
    Replies:
    1
    Views:
    412
  4. Guest
    Replies:
    3
    Views:
    391
    Andrew Thompson
    Nov 30, 2004
  5. caribprogrammer

    Poblems with my Driven Menu in ASP.Net

    caribprogrammer, Apr 25, 2008, in forum: .NET
    Replies:
    0
    Views:
    350
    caribprogrammer
    Apr 25, 2008
Loading...

Share This Page