summaryrefslogtreecommitdiff
path: root/macros/generic/termmenu/README
blob: 9a110bbd1224467392265eba4026a9cfb555d1a0 (plain)
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
74
75
76
77
78
79
80
termmenu - Terminal-driven menus in TeX
=======================================

When writing programs, it's often required to present the user with a
list of options/actions.  The user is then expected to select one of
these options for the program to process.

`termmenu` provides this mechanism for TeX.  Using `termmenu` requires
only `expl3` support, thus the `l3kernel` and `l3packages` are both
required.

----------------------------------------------------------------------

`termmenu.dtx` may be distributed and/or modified under the conditions
of the LaTeX Project Public License (LPPL), either version 1.3c of
this license or (at your option) any later version.  The latest
version of this license is in the file

    http://www.latex-project.org/lppl.txt

The released version is available from CTAN.

----------------------------------------------------------------------

The development version can be found at

    http://www.github.com/vermiculus/tex-termmenu

for those people who are interested.

Installation
------------

To install `termmenu`, simply run

    tex termmenu.ins

`termmenu.tex` will be produced.  Since it can be run by anything that
can run `expl3`, I recommend placing it in `tex/generic/termmenu`.

To produce the documentation, run `pdflatex` or
[`arara`](https://github.com/cereda/arara) on the file as normal.

Usage
-----

Full documentation is available in `termmenu.pdf`, but using
`termmenu` is very simple if you're familiar with `expl3` programming:

    \termmenu_new:N \g_demo_termmenu

will create a menu and
   
    \termmenu_add:Nnnn \g_demo_termmenu { option }
      { Description text }
      { \msg_term:n { Actions } }

will add a menu item.  The user is prompted with

    \termmenu_get_choice:NN \g_demo_termmenu \l_tmpa_tl

and an action is taken with

    \termmenu_exec:NV \g_demo_termmenu \l_tmpa_tl

The menu itself looks something like this:

    *************************************************
    * Menu
    *************************************************

    The following commands are available:

        > option
            Description text

    \choice=option
    *************************************************
    * Actions
    *************************************************