You are not logged in.

#1 2015-05-22 20:44:48

esa
Member
Registered: 2011-12-29
Posts: 143
Website

Text User Interface - (bling bling) framework for scripts

Introducing TUI 0.9.4-2
What is it exactly?

Obvious to its name, its about getting a simple Text Interface for your scripts.
But rather than trying to be a window emulation/simulation, it remains text'ish, and brings other geat values along.


Depends on:

bash, coreutils (read, printf,awk,grep,sed), which makes it perfect for systems with a minimalist approach.

How does it work?

Basicly, it is ment that one just 'needs' to execute the commands, as they 'just wrap' the command to an output with borders and titles.
However, it uses an rc file to provide its core variables that are used for user configuration/preferences.
There is a systemwide default configuration in /etc/tui/*conf, which will be overwritten (userspace) by the user configuration loading order of ~/.config/tui/loadlist.conf.
A full overview of all the (shared) variables used by TUI, see:

tuirc provides

Homepage: https://savannah.nongnu.org/projects/tui/
Code: http://git.savannah.nongnu.org/cgit/tui.git


Installation is is easy:
git clone https://github.com/sri-arjuna/tui.git
cd tui
su
./configure --prefix=/usr
make
sudo make install-all

However, for any non-default path, you must manualy enable the binarydir to your $PATH used.

Themes

There are some themes available, and you could create your own ones in ~/.config/tui/themes.

Description:

Each command serves one single purpose, and is designed to make scripting alot easier and more fun.
However, as a set, they accumulate to a full interface feeling, at least if there is more than just 1 or 2 lines of visual output.
There are also scripts that do not create 'visual output' but are thought to fill a variable, they do not print the interface borders.

It is ment to make scripts easy share-able across distributions/brands, as long one has TUI installed.
While it only requires coreutils and bash, you dont have to write bash scripts to use it, it works well from ash, csh, ksh, zsh or whatnot.

Best experience to install to PREFIX=/usr or CHROOT=/ (required for the conf dir '/etc' if the PREFIX doesnt start with /usr)
As that results in:   /usr/bin/tui*, /etc/tui/*conf, /usr/share/tui/themes, /usr/share/man/man1/tui*.1.gz

Another nice thing

While it works without any configuration (other than defining its install path (CHROOT=/ ./install.sh)).
Any scripter doesnt have to care about which editor, terminal, web or filebrowsers are installed on the user its system, TUI handles the reckognition and selection of these.
It should already cover most situations, even if it uses the 'fallback' ones, such as vi, lynx or xterm.
If it doesnt find/reckognize your application, change it in the ~/.config/tui/apps.conf and let me know about it, so it will after future updates.

Some examples:

This reads from file /etc/default/grub the variable  GRUB_TIMEOUT and prints it to stdout.

$ tui-conf-get /etc/default/grub GRUB_TIMEOUT
5

This passes error code 1 (could be $? for dynamic handling) and prints first passed string on the left, 2nd passed string centered and on the right side either an 'icon' (5) or 'text' (1/3) status (return code) information. It then exits with the passed number as its own exit code.

$ tui-status 1 "Error caused on line $LINENO"
# | Error caused on line 10                                                                               [  ✘   ] | #
$ tui-select tmp/*
# | 1) tmp/15692                                    2) tmp/22276                                  3) tmp/awesome64 | #
# | 4) tmp/glen                                   5) tmp/inputfile                                6) tmp/sample.sh | #
# | 7) tmp/sample.txt                            8) tmp/test_trap.sh                                     9) tmp/YY | #
# | > 1 
tmp/15692
$ tui-list tmp/*
# | 1) tmp/15692                 2) tmp/22276              3) tmp/awesome64 | #
# | 10) tmp/videotuts.sh3                                        11) tmp/YY | #

$ tui-list -r2 tmp/*
# | I. tmp/15692                                              II. tmp/22276 | #
# | V. tmp/inputfile                                      VI. tmp/sample.sh | #

$ tui-list -1a tmp/*
# | a) tmp/15692                                                            | #
# | b) tmp/22276                                                            | #

There are also wrappers for (new custom - and internal only-)env variables, for editor, webbroser, filemanager and terminal.
As in, it uses your favorite  application according to the configuration done, and according to wether you are in GUI or CLI mode (graphical vs multiuser/emergency).

$ tui-edit ~/.bashrc
# | Opening:                                                                                     /home/sea/.bashrc | #

Highly customizeable progress bar:

0 ~ $ tui-progress "test msg"
# | test msg                                                                                              [  /   ] | #
$ tui-progress -m 15 "test msg"
# | test msg                                                                                            [ 3 / 15 ] | #
$ tui-progress -m 15 -c 13 "test msg"
# | test msg                                                                                           [ 13 / 15 ] | #
$ tui-progress -bm 15 -c 13 "test msg"
# | test msg     [==================================================================================             ] | #
$ tui-progress -lbm 15 -c 13 "test msg"
# | test msg [==============================================================================          ] [ 86.66% ] | #

And lots more.
While this post is fresh, i'm currently writing another post about VHS (Video Handler Script) which is a wrapper for FFMPEG and uses this framework.
Stay tuned tongue

Hope you like it and have fun.

Last edited by esa (2016-01-13 18:51:58)


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

#2 2015-05-24 15:56:18

esa
Member
Registered: 2011-12-29
Posts: 143
Website

Re: Text User Interface - (bling bling) framework for scripts

0.8.0-3

  • Fixed:     tui-wait, had a local reference left from devel branch

0.8.1-0

  • Fixed:     tui, checked for user configurations without the path (figured because of image below)

  • Updated:   tui-select, didnt have -1|2 in the getopts parselist, if passed, it shows this many columns instead of 3
                Its output (selected-item) was unstable at some conditions (newline)

Image: --> Different theme's preview within different terminals <-- (click on 'raw' to enlarge the image)

Just posted this update as it provides a hotfix to an essential function that got lost because of a 'typo', eventhough it was workin fine in 0.7.6-5.
So it is now behaving (again) accuratly as it should.

However, there are 2 remainers that still need taken care of, though they dont seem to care about the changes and work fine for me atm.
They are:

  • tui-browser, latest and most complex command of the framework

  • tui-psm (paralell script manager), allow -v(erbose) so executed scripts start in their own gui-terminal.

Hope you like it, have fun smile

Last edited by esa (2015-05-24 15:57:04)


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

#3 2015-05-27 00:11:54

esa
Member
Registered: 2011-12-29
Posts: 143
Website

Re: Text User Interface - (bling bling) framework for scripts

I'm sorry for the inconveniences.
When i opened the post, it seemed as stable as it used to be before the changes to the RC file.
Figured, i was wrong.

And since it, not even to me, was not useable at all, i hope you give it another chance after reviewing these changes:

0.8.1-1

  • Fixed:     install.sh, bash-completion path was missing 'share'

  • Fixed:     uninstall.sh, now uses the RC file too

  • Fixed:     tui-status/conf.etc/status.conf, didnt recognize console

  • Added:     docs/samples/tui_{browser,list,read,select,status,yesno}

  • Updated:   tui-bgjob, added option -e BYTES, which may obsolete option -s FILE on some occasions. Either of which is required to use a progress bar as indicator.

  • Updated:   tui-cp, showed wrong name in helpscreen

  • Changed:   Screenshot structure

  • Changed:   tui info -> tui provides, better structured output

  • Changed:   tui-psm, verbose mode enables terminal windows, gui only

0.8.1-3

  • - Changed:   tui-asroot, commands.conf, moved '$SUDO' declaration

  • - Changed:   tui-psm, hopefully improved logfile reading

  • - Changed:   tui-progress, bar adjustmets... 3/4, really?

  • - Changed:   install.sh

  • - Fixed:     tui-bgjob, hotfix of option parsing

  • - Fixed:     tui-cp, variable hotifx

I dont want to spam you (here too) with further changelogs, but since i just introduced it here, i wanted you to know its usable again, and (currently) seems as stable as before.

Thank you and hope you like it.

Last edited by esa (2015-05-27 00:14:16)


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

#4 2016-01-13 18:04:45

esa
Member
Registered: 2011-12-29
Posts: 143
Website

Re: Text User Interface - (bling bling) framework for scripts

Version 0.9.4-2 (and upcoming) can now be installed using yaourt. cool

I have had it in the GNU evaluation queue, but its missing a 'userbase'.
So if you like it, please drop a line here in the forum, or at its G+ group, where i try to get it running wink

Hope you like it, feedback very much appreciated!
(doesnt mean i will apply/write every wish or suggestion - just saying)

Happy scripting!

Last edited by esa (2016-01-13 18:09:55)


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

Board footer

Powered by FluxBB