Text User Interface, framework for scripts - Summary
This group is not part of the GNU Project.
1. Intro
2. For who?
3. F.A.Q.
4. Samples-Preview
Almost everyone who is writing scripts has to write his own functions so
certain tasks can be accomplished in a simpler way, and work the script way.
With TUI i want to provide much more than just a basic display tool,
those are just 4 commands, and there are more than 40 other
tools to ease the task in scripting. For example, it offers tui-conf-editor
which is based upon the commands tui-conf-get and tui-conf-set and provides
a 'full configuration editor'.
What TUI does is it wraps a (limited) theme'able interface around
coreutils (also as synonym for most basic tools) and matching them together,
to make a common interface (display/output) for all of them.
Now, eventhough it requres BASH, with each function beeing a command,
they can be executed by any other shell, as they are stored as scripts/files,
and not provided by functions.
This gives script-writers the freedom to not be bound to BASH only.
As TUI is meant to be used for/with scripts, its handling output 'per-line'.
In a similar meaning as "echo Hello World" is a per-line output too.
But an interface provides more than just left aligned text, it allows text to
be aligned to the center or right hand side of the terminal, colored background,
and much more convenient things.
What motivates me the most, all those 'similar' tools, are all 'boxed',
as in dialog. But very often, that produces a 'waste of space' when
having a single checkbox and a yes/no button as a maximized console window.
In fact, i also provide a 'box', thought it is not like dialog.
That 'box' is named tui-browser and is folder, file and argument driven,
while enabling the user to achieve highly complex but still structured
command line syntax to access regions within a certain sub path of the
initial shown menu directory, list its content.
And much, much, more!
As most of us are aware, the GNU (*nix) experience is not for everyone alike.
TUI allows scripters to write scripts for end-users, without the need to care about installed applications (editor, webbrowser, filemanager, terminal-windows) nor wether the end user is in GUI or console mode.
TUI is an attempt to make new users (or console-phobics) more comfortable with the terminal per se.
But without the pseudo illusion of a fake 3d windowed environment, which just looks outdated.
For end-users, TUI is only a dependecy such as ncurses, dialog or any QT, GTK or Phyton library.
For developers/scripters, TUI is an easy way to write a handler, a wizzard or a tool, that will work and be interactive in both GUI and console.
Q:
What can i do with TUI?
*A:"
What can you script?
With TUI you will achieve more - easier and faster!
Q:
What is TUI about?
A:
About giving a script an interface like feeling.
Q:
So you have that(several, actually) wizzard/guide/complex script, which has several cool functions which you share among your own projects?
But to keep all those functions up to date is annoying?
A:
TUI aims to provide the most common functions/functionality that a scripter might require.
So you can focus on your script, and let the displaying be done by TUI.
Q:
But i want my script users to have GUI interactions as well, we live in modern times, you know!
A:
I know, that is why it is even simpler by using TUI!
You will not have to worry about the user his favorite text-editor, web-browser or file-manager or gui-terminal, neither in GUI, nor on the CLI!
TUI will first read the default config for either CLI or GUI, if that is not found, it will parse a list of known applications, and save the first application for that mode for next use.
And if no application is found, TUI asks the user to enter his favorite application.
As you see, alot less to worry about.
Q:
TUI has the development status 'beta'.
Is it save to use?
A:
Since its extraction of script-tools (my initial project, from 2011) more than 2 years ago (~June 2013), i'm using it for other script-based projects of mine.
I've not had any bad experiences, other than glitches between updates (of files beeing worked on) that is.
It is stable, but doesnt provide all the functions at the level i want/ed (just yet), therefor i do not consider it 'production/stable'.
Get a random jpg file of a folder.
function rnd_pic() { # DIR [EXT=jpg]
# Requires DIR and searches for EXT
# Prints TUI to stderr and returnvalue to stdout.
declare work_dir="${1:-.}"
declare EXT=${2:-jpg}
declare -a list
tui-status -r 2 "Parsing:" "$work_dir" >&2
list=($(cd "$work_dir";ls -1 *.$EXT))
max=$(( ${#list[@]} - 1 ))
nr=$(tui-rnd $max)
item=${list[$nr]}
tui-status $? "Selected:" "$item" >&2
echo "$item" >&1
}
Which could look like: (please widen the viewport of the texbox below)
0 ~/.backgrounds $ var=$(rnd_pic .);echo "var: $var"
# | Selected: 2014-15368085169_81057547d7_o.jpg [ ✓ ] | #
var: 2014-15368085169_81057547d7_o.jpg
0 ~/.backgrounds $ var=$(rnd_pic .);echo "var: $var"
# | Selected: 2014-10869687_340037772868334_1938305955706092202_o.[ ✓ ] | #
var: 2014-10869687_340037772868334_1938305955706092202_o.jpg
Registration Date: Mon 21 Sep 2015 02:23:09 PM UTC
License: GNU General Public License v3 or later
Development Status: 4 - Beta
Powered by Savane 3.14-8aba.
Corresponding source code