slitaz-base-files view doc/libtaz.txt @ rev 289

libtaz: implement options --quiet and --cols=
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Dec 03 04:59:59 2015 +0200 (2015-12-03)
parents 3f16616140ea
children 5829aa52b9ee
line source
2 SYNOPSIS
3 . /lib/libtaz.sh
4 function
7 DESCRIPTION
8 LibTaz is the base SliTaz SHell library used by almost all tools and
9 utilities. It provides common SHell script functions, parses the cmdline
10 options and store values in a variable. The output messages can be
11 formatted for raw/text, gtk, html and by default they are formatted for
12 a standard terminal supporting colors. LibTaz is in the directory
13 /lib/libtaz.sh since it is used when /usr may not be mounted.
16 FUNCTIONS
17 _ <string> Short name for "eval_gettext string; echo"
18 _n <string> Short name for "eval_gettext string"
19 status Return command status [Done|Failed]
20 separator [<char>] Display a line separator
21 newline Echo a new line if gettext or echo -n is used
22 boldify <string> Use a bold font for term, html or GTK output
23 colorize NB <string> Colorize a string in term mode
24 indent NB [string] Indent text in term mode
25 emsg <string> Output mark up messages
26 check_root Check if user is logged as root
27 debug <string> Display a DEBUG message when --debug is used
28 confirm Read answer to confirm an action
29 log <string> Log activity, $activity must be set
30 optlist <lines> Prints two-column list (of options, or functions, etc.)
31 longline <string> Wrap words in long terminal message
32 title <string> Print localized title
33 footer [<string>] Print footer
34 action <string> Print action
35 itemize <string> Print long line as list item (check for :-* markers)
38 OPTIONS
39 --output=[raw|gtk|html]
40 --activity=/path/files/activity
41 --quiet Display nothing but errors (usually: action ... status)
42 --cols=<number> Output width in columns
45 EXAMPLES
46 _ 'Hello, $USER!'
47 _ 'Hello, %s!' $USER
49 echo -n 'Removing...'; rm $file; status
51 separator
52 separator '*'
54 newline
56 boldify 'Bold text'
58 colorize 32 "Message"
59 myprogram --color=32
61 indent 32 "Message"
63 emsg "<b>bold</b> <c 31>red</c> separator<-> newline<n> <i 26>indent"
65 check_root
67 debug "A='$A'"
69 echo -n "The question"; confirm
70 confirm "The question (y/N)?"
72 activity='/var/log/my.log'
73 log "Message"
75 optlist "\
76 option1 Description1 (after one or any number of tab symbols)
77 -a option2 $(_ 'Description2')"
79 longline $(busybox --help)
80 longline "$(cat /usr/share/licenses/lgpl.txt)"
82 title "Summary"
83 footer "$(_ 'No errors found')"
84 action 'Checking settings...'; checking_settings; status
86 itemize " - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed d\
87 o eiusmod tempor incididunt ut labore et dolore magna aliqua."
88 itemize " * Ut enim ad minim veniam, quis nostrud exercitation ullamco lab\
89 oris nisi ut aliquip ex ea commodo consequat."
92 USAGE NOTES
93 SliTaz Base functions used from boot scripts to end user tools.
94 Use gettext and not echo for messages. Keep output suitable for GTK boxes
95 and Ncurses dialog. LibTaz should not depend on any configuration file.
96 No bloated code here, functions must be used by at least 3-4 tools.
99 AUTHORS
100 Christophe Lincoln
101 Aleksej Bobylev