
SYNOPSIS
	. /lib/libtaz.sh
	function


DESCRIPTION
	LibTaz is the base SliTaz SHell library used by almost all tools and
	utilities. It provides common SHell script functions, parses the cmdline
	options and store values in a variable. The output messages can be
	formatted for raw/text, gtk, html and by default they are formatted for
	a standard terminal supporting colors. LibTaz is in the directory
	/lib/libtaz.sh since it is used when /usr may not be mounted.


FUNCTIONS
	_ <string>            Short name for "eval_gettext string; echo"
	_n <string>           Short name for "eval_gettext string"
	status                Return command status [Done|Failed]
	separator [<char>]    Display a line separator
	newline               Echo a new line if gettext or echo -n is used
	boldify <string>      Use a bold font for term, html or GTK output
	colorize NB <string>  Colorize a string in term mode
	indent NB [string]    Indent text in term mode
	emsg <string>         Output mark up messages
	check_root            Check if user is logged as root
	debug <string>        Display a DEBUG message when --debug is used
	die <string>          Report error and finish work
	im                    Returns true if you're in interactive mode
	confirm               Read answer to confirm an action
	log <string>          Log activity, $activity must be set
	optlist <lines>       Prints two-column list (of options, or functions, etc.)
	longline <string>     Wrap words in long terminal message
	title <string>        Print localized title
	footer [<string>]     Print footer
	action <string>       Print action
	itemize <string>      Print long line as list item (check for :-* markers)


OPTIONS
	--output=[raw|gtk|html]
	--activity=/path/files/activity
	--quiet               Display nothing but errors (usually: action ... status)
	--cols=<number>       Output width in columns


EXAMPLES
	_ 'Hello, $USER!'
	_ 'Hello, %s!' $USER

	echo -n 'Removing...'; rm $file; status

	separator
	separator '*'

	newline

	boldify 'Bold text'

	colorize 32 "Message"
	myprogram --color=32

	indent 32 "Message"

	emsg "<b>bold</b> <c 31>red</c> separator<-> newline<n> <i 26>indent"

	check_root

	debug "A='$A'"

	die 'Config %s absent. Exit' $config


	Using confirm()
	Use global options for auto-answering: '--yes' or '--noconfirm'.
	Use global option '--timeout' to define the wait time (default is 30 s).
	The letters "y", "Y", "n" and "N", used in the response, are localized.
	1. Outdated syntax. No options. Displays translated " [y/N] ? " and waits
	   for your input.
	   Answer formula is "[y/N]": to answer "yes" you need to enter "y" (or "Y"),
	   while to answer "no" you may enter "n" or "N" or any other letter, or
	   even just press Enter.

	   echo -n "The question"; confirm && echo "Confirmed"

	2. New syntax. Option is the string displayed. Answer formula the same.

	   confirm "The question [y/N]?" && echo "Confirmed"

	3. Modern syntax. Two options: the question and the preferred answer.
	   Displays the question and then translated answer formula as "[Y/n]" or
	   "[y/N]" depending on the preferred answer.

	   confirm "The question?" y && echo "Confirmed"

	In all cases, it returns "true" if you answer "yes", while returns "false"
	otherwise.


	activity='/var/log/my.log'
	log "Message"

	optlist "\
   option1		Description1 (after one or any number of tab symbols)
-a option2		$(_ 'Description2')"

	longline $(busybox --help)
	longline "$(cat /usr/share/licenses/lgpl.txt)"

	title "Summary"
	footer "$(_ 'No errors found')"
	action 'Checking settings...'; checking_settings; status

	itemize "  - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed d\
o eiusmod tempor incididunt ut labore et dolore magna aliqua."
	itemize "  * Ut enim ad minim veniam, quis nostrud exercitation ullamco lab\
oris nisi ut aliquip ex ea commodo consequat."


USAGE NOTES
	SliTaz Base functions used from boot scripts to end user tools.
	Use gettext and not echo for messages. Keep output suitable for GTK boxes
	and Ncurses dialog. LibTaz should not depend on any configuration file.
	No bloated code here, functions must be used by at least 3-4 tools.


AUTHORS
	Christophe Lincoln
	Aleksej Bobylev

