File: README.adoc

package info (click to toggle)
ssft 0.9.17
  • links: PTS
  • area: main
  • in suites: buster
  • size: 168 kB
  • sloc: sh: 1,161; makefile: 50
file content (73 lines) | stat: -rw-r--r-- 2,014 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
= Shell Scripts Frontend Tool
Sergio Talens-Oliag <sto@debian.org>

Shell function library useful to build script frontends.

The library defines a set of functions to display messages and read values from
the user on X (using `zenity` or `kdialog`) or console (using `dialog` or
_plain text_) and has been designed to be used by sourcing the library code
from other scripts.

The library supports L10N if `gettext.sh` is installed.

== Basic usage

On the typical case the library must be sourced and the `SSFT_FRONTEND`
variable must be set to the desired frontend (`zenity`, `dialog` or `text`); if the
variable is not set the default frontend is `noninteractive`.

To choose the theoretically best looking frontend use the function
`ssft_choose_frontend` as follows:

[source,sh]
----
. ssft.sh || exit 1
[ -n "$SSFT_FRONTEND" ] || SSFT_FRONTEND="$( ssft_choose_frontend )"
----

== Functions and usage documentation

If the script is executed without arguments it prints an usage message and also
supports the options `--doc`, `--help` and `--version`

To get a list of available functions call the script with the `--doc` or `-d` argument:

[source,console]
----
$ ssft.sh -d
ssft_set_textdomain
ssft_reset_textdomain
ssft_pager
ssft_choose_frontend
ssft_print_text_title
ssft_display_message
ssft_display_error
ssft_display_emsg
ssft_file_selection
ssft_directory_selection
ssft_progress_bar
ssft_read_string
ssft_read_password
ssft_select_multiple
ssft_select_single
ssft_yesno
ssft_show_file
----

To get a description of what a given function does call the script with the
arguments `--doc FUNCTION_NAME`, i. e.:

[source,console]
----
$ ssft.sh -d ssft_choose_frontend

Function: ssft_choose_frontend

Description: print the name of the preferred frontend, but don't set it
----

== Sample scripts

See the `ssft-test.sh` script for a full usage example; it is distributed with
the code inside the `test` directory and the Debian package leaves a copy on
`/usr/share/doc/ssft/examples/ssft-test.sh.gz`.