|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 03-May-2022 | - |
| build-aux/ | H | 05-Jun-2021 | - | 5,102 | 4,160 |
| examples/ | H | 05-Jun-2021 | - | 523 | 312 |
| tests/ | H | 05-Jun-2021 | - | 8,447 | 6,368 |
| .clang-format | H A D | 05-Jun-2021 | 1.4 KiB | 46 | 45 |
| COPYRIGHT | H A D | 05-Jun-2021 | 59 | 4 | 2 |
| ChangeLog | H A D | 05-Jun-2021 | 11.9 KiB | 273 | 252 |
| FAQ | H A D | 05-Jun-2021 | 1.3 KiB | 33 | 25 |
| LICENSE.rst | H A D | 05-Jun-2021 | 17.6 KiB | 342 | 285 |
| Makefile.am | H A D | 05-Jun-2021 | 873 | 22 | 20 |
| Makefile.in | H A D | 05-Jun-2021 | 30 KiB | 917 | 812 |
| README.rst | H A D | 05-Jun-2021 | 6.2 KiB | 196 | 146 |
| SUMMARY | H A D | 05-Jun-2021 | 194 | 5 | 3 |
| TODO | H A D | 05-Jun-2021 | 167 | 5 | 4 |
| aclocal.m4 | H A D | 05-Jun-2021 | 40.9 KiB | 1,133 | 1,028 |
| build.sh | H A D | 05-Jun-2021 | 649 | 31 | 12 |
| config.h.in | H A D | 05-Jun-2021 | 4.2 KiB | 165 | 116 |
| configure | H A D | 05-Jun-2021 | 188.2 KiB | 6,645 | 5,516 |
| configure.ac | H A D | 05-Jun-2021 | 1.5 KiB | 62 | 48 |
| ctxopt.c | H A D | 05-Jun-2021 | 147.5 KiB | 4,827 | 3,101 |
| ctxopt.h | H A D | 05-Jun-2021 | 2.9 KiB | 114 | 82 |
| fgetc.c | H A D | 05-Jun-2021 | 1.3 KiB | 43 | 22 |
| fgetc.h | H A D | 05-Jun-2021 | 358 | 16 | 7 |
| index.c | H A D | 05-Jun-2021 | 8.9 KiB | 343 | 231 |
| index.h | H A D | 05-Jun-2021 | 1.8 KiB | 70 | 41 |
| list.c | H A D | 05-Jun-2021 | 8.5 KiB | 301 | 179 |
| list.h | H A D | 05-Jun-2021 | 1.5 KiB | 76 | 47 |
| smenu.1 | H A D | 05-Jun-2021 | 65.1 KiB | 1,751 | 1,514 |
| smenu.c | H A D | 05-Jun-2021 | 369.3 KiB | 11,448 | 7,824 |
| smenu.h | H A D | 05-Jun-2021 | 23.5 KiB | 630 | 429 |
| smenu.spec.in | H A D | 05-Jun-2021 | 1.2 KiB | 60 | 49 |
| usage.c | H A D | 05-Jun-2021 | 11.8 KiB | 305 | 265 |
| usage.h | H A D | 05-Jun-2021 | 466 | 28 | 15 |
| utf8.c | H A D | 05-Jun-2021 | 16.1 KiB | 562 | 369 |
| utf8.h | H A D | 05-Jun-2021 | 1 KiB | 58 | 34 |
| utils.c | H A D | 05-Jun-2021 | 7.9 KiB | 337 | 208 |
| utils.h | H A D | 05-Jun-2021 | 1.2 KiB | 72 | 45 |
| version | H A D | 05-Jun-2021 | 7 | 2 | 1 |
| xmalloc.c | H A D | 05-Jun-2021 | 3.8 KiB | 178 | 111 |
| xmalloc.h | H A D | 05-Jun-2021 | 319 | 26 | 17 |
README.rst
1.. image:: smenu.gif
2
3|
4
5.. image:: simple_menu.gif
6
7What is it?
8===========
9**smenu** is a selection filter just like ``sed`` is an editing filter.
10
11This tool takes words from standard input or from a file and presents
12them on the screen in different layouts in a scrolling window.
13A cursor that you can easily move lets you select one or more of them.
14
15Note that the screen is not previously cleared when the scrolling window
16of **smenu** is displayed.
17
18I tried to make its use as simple as possible. It supports the ``UTF-8``
19encoding and should work on all terminals managed by the ``terminfo``
20database.
21
22Please use the included man page to learn more about this little program.
23
24The `wiki <https://github.com/p-gen/smenu/wiki>`_ contains screenshots and
25animations that detail some concepts and features of **smenu**.
26
27How to build it?
28================
29**smenu** can be built on any system on which a working ``terminfo``
30development platform is available. This includes every Unix and
31Unix-like system I am aware of.
32
33Please use the provided ``build.sh`` script to build the executable.
34This script accepts the same arguments as the GNU ``configure`` script,
35type ``build.sh --help`` to see them.
36
37The script ``autogen.sh`` is also provided if you need to generate a
38new ``configure`` script from ``configure.ac`` and ``Makefile.am``. The
39GNU **autotools** will need to be installed for this script to work.
40
41How to install it?
42==================
43Once the build process has finished, a simple ``make install`` with the
44appropriate privileges will do it.
45
46Issue vs Discussion.
47====================
48I have enabled `discussions <https://github.com/p-gen/smenu/discussions>`_
49on this repository.
50
51I am aware there may be some confusion when deciding where you should
52communicate when reporting issues, asking questions or raising feature
53requests so this section aims to help us align on that.
54
55Please `raise an issue <https://github.com/p-gen/smenu/issues>`_ if:
56
57- You have found a bug.
58- You have a feature request and can clearly describe your request.
59
60Please `open a discussion <https://github.com/p-gen/smenu/discussions>`_ if:
61
62- You have a question.
63- You're not sure how to achieve something with smenu.
64- You have an idea but don't quite know how you would like it to work.
65- You have achieved something cool with smenu and want to show it off.
66- Anything else!
67
68Some examples.
69==============
70
71Linux example.
72--------------
73This program should work on most Unix but if you are using Linux,
74try to type the following line at a shell prompt (here: ``"$ "`` ):
75
76::
77
78 $ R=$(grep Vm /proc/$$/status \
79 | smenu -n20 -W $':\t\n' -q -c -b -g -s /VmH)
80 $ echo $R
81
82Something like this should now be displayed with the program waiting
83for commands: (numbers are mine, yours will be different)
84
85::
86
87 VmPeak¦ 23840 kB
88 VmSize¦ 23836 kB
89 VmLck ¦ 0 kB
90 VmHWM ¦ 2936 kB
91 VmRSS ¦ 2936 kB
92 VmData¦ 1316 kB
93 VmStk ¦ 136 kB
94 VmExe ¦ 28 kB
95 VmLib ¦ 3956 kB
96 VmPTE ¦ 64 kB
97 VmSwap¦ 0 kB
98
99A cursor should be under ``"VmHWM "``.
100
101After having moved the cursor to ``" 136 kB"`` and ended the program
102with ``<Enter>``, the shell variable R should contain: ``" 136 kB"``.
103
104Unix example.
105-------------
106The following command, which is Unix brand agnostic, should give you a
107scrolling window if you have more than 10 accounts on your Unix with a
108UID lower than 100:
109
110::
111
112 $ R=$(awk -F: '$3 < 100 {print $1,$3,$4,$NF}' /etc/passwd \
113 | smenu -n10 -c)
114 $ echo $R
115
116On mine (``LANG`` and ``LC_ALL`` set to ``POSIX``) it displays:
117
118::
119
120 at 25 25 /bin/bash \
121 sys 0 3 /usr/bin/ksh +
122 bin 1 1 /bin/bash |
123 daemon 2 2 /bin/bash |
124 ftp 40 49 /bin/bash |
125 games 12 100 /bin/bash |
126 lp 4 7 /bin/bash |
127 mail 8 12 /bin/false |
128 named 44 44 /bin/false |
129 ntp 74 108 /bin/false v
130
131Note the presence of a scrollbar.
132
133Bash example (CRTL-R replacement)
134---------------------------------
135Just add the following in your ``.bashrc``
136
137::
138
139 EOL=$'\n'
140 bind -x '"\C-r": READLINE_LINE=$(fc -lr 1 \
141 | sed "s/[1-9][0-9]*..//" \
142 | smenu -Q -l -a c:7/4b -W"$EOL")
143 READLINE_POINT=${#READLINE_LINE}'
144
145Launch or relaunch **bash** and hit ``CTRL-R`` (``CTRL-C`` or ``q``
146to exit), enjoy!
147
148You can also add the parameter **-d** to instruct **smenu** to clean
149the selection window after selecting an entry.
150
151Warning for post v0.9.15 versions.
152----------------------------------
153These versions use a new options system called **ctxopt** which
154may contain bugs.
155Please report them so they can be fixed in the next release of **smenu**
156or **ctxopt** (https://github.com/p-gen/ctxopt).
157
158Command line arguments may also need to be rearranged in some cases
159because of this new option management system.
160Sorry for the extra work this might entail.
161
162Testing and reporting.
163----------------------
164The included testing system is relatively young, please be indulgent.
165
166**IMPORTANT** the testing system has some dependencies, please read the
167``test/README.rst`` before going further.
168
169**NOTE** running all the tests by running ``./tests.sh`` in the
170``tests`` directory will take some time (around 21 min for now).
171
172**NOTE** on some systems like \*BSD some tests may fail. This can be
173explained by differences in posix/libc/... implementations. This can
174notably occur when some specific regular expressions or uncommon ``UTF-8``
175byte sequences are used.
176
177If a test fails for unknown reason, then please send me its directory
178name and the relevant ``.bad`` file.
179
180If you are hit by a bug that no test covers, then you can create a new
181test in the ``tests`` directory in an existing or new directory: read the
182``tests/README.rst`` file, use an existing test as model, create an
183``.in`` file and a ``.tst`` file and send them to me as well as the
184produced files.
185
186Contributions.
187--------------
188Contributions are welcome but discuss your proposal in an issue first,
189or with the maintainer.
190
191Special thanks.
192---------------
193I want to thank those who took the time to package **smenu** for their
194preferred operating system or distribution.
195You will find their names here: https://repology.org/project/smenu/packages
196