What Ncurses Frameworks Are Available for Bash

What ncurses frameworks are available for BASH?

If all you need to do is prompt the user for information, take a look at dialog.

http://invisible-island.net/dialog/dialog.html

Bash script with graphical menus

there is a package called dialog, is this relevant to your requirement?

what would be a good alternative to ncurses that will work under emacs shell?

There is nothing like ncurses that works under Emacs' shell-mode. This is a fundamental limitation of the design of comint-mode, which is what shell-mode is built on: it only works with programs that alternately read whole lines of plain text from stdin and write whole lines of plain text to stdout.

If you want to run something fancier, you need to use a full terminal emulator (which Emacs has, of course), or else to write an Emacs-specific front end that uses Emacs buffers natively.

Does a C++ shell framework exist?

You can keep using Fry::Shell. It's not much of a hassle to call Perl from C++. Here's a starting point for that, there might be a better way to do it.

EDIT: I just found a project on Github. It's written in C and seems pretty much dead, but try it out, it might be useful. Even if it's not, since it's open source, you can use it as a starting point. It claims to provide a Cisco-like interface, which should suit you pretty well.

Automated test tools for Linux/ncurses

I have considered using Rational Function Tester and TestComplete.

RFT has explicit support for testing this type of application (text-mode linux) via built-in terminal emulation.

TestComplete does not support testing Linux apps directly, but can be made to work by "testing" a COM-enabled terminal emulation program (Attachmate Reflection at this stage), and using COM from the test scripts to do screen scraping.

Have also considered using Reflection as the terminal emulator and rolling my own test framework in C# and NUnit.

Edit: "Final" solution is using Terminator (a Java terminal emulator), extending it with an RMI interface and using TestNG...

What's a good Java, curses-like, library for terminal applications?

There is Charva, which links to native code but has an api based on Swing.
The screenshots show lots of text windows, so that looks useful.

How do I read any one key in Bash?

You are better off using dialog as jm666 mentioned, but there are other ways to skin that cat.

read -n 1 x; while read -n 1 -t .1 y; do x="$x$y"; done

Basically wait until you read a character and then spin consuming input until .1 seconds has passed w/o input.

Warning, fast typists could get annoyed. You might need to tweak that timeout.

How to add a progress bar to a shell script?

You can implement this by overwriting a line. Use \r to go back to the beginning of the line without writing \n to the terminal.

Write \n when you're done to advance the line.

Use echo -ne to:

  1. not print \n and
  2. to recognize escape sequences like \r.

Here's a demo:

echo -ne '#####                     (33%)\r'
sleep 1
echo -ne '############# (66%)\r'
sleep 1
echo -ne '####################### (100%)\r'
echo -ne '\n'

In a comment below, puk mentions this "fails" if you start with a long line and then want to write a short line: In this case, you'll need to overwrite the length of the long line (e.g., with spaces).



Related Topics



Leave a reply



Submit