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