• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

build-aux/H05-Jun-2021-5,1024,160

examples/H05-Jun-2021-523312

tests/H05-Jun-2021-8,4476,368

.clang-formatH A D05-Jun-20211.4 KiB4645

COPYRIGHTH A D05-Jun-202159 42

ChangeLogH A D05-Jun-202111.9 KiB273252

FAQH A D05-Jun-20211.3 KiB3325

LICENSE.rstH A D05-Jun-202117.6 KiB342285

Makefile.amH A D05-Jun-2021873 2220

Makefile.inH A D05-Jun-202130 KiB917812

README.rstH A D05-Jun-20216.2 KiB196146

SUMMARYH A D05-Jun-2021194 53

TODOH A D05-Jun-2021167 54

aclocal.m4H A D05-Jun-202140.9 KiB1,1331,028

build.shH A D05-Jun-2021649 3112

config.h.inH A D05-Jun-20214.2 KiB165116

configureH A D05-Jun-2021188.2 KiB6,6455,516

configure.acH A D05-Jun-20211.5 KiB6248

ctxopt.cH A D05-Jun-2021147.5 KiB4,8273,101

ctxopt.hH A D05-Jun-20212.9 KiB11482

fgetc.cH A D05-Jun-20211.3 KiB4322

fgetc.hH A D05-Jun-2021358 167

index.cH A D05-Jun-20218.9 KiB343231

index.hH A D05-Jun-20211.8 KiB7041

list.cH A D05-Jun-20218.5 KiB301179

list.hH A D05-Jun-20211.5 KiB7647

smenu.1H A D05-Jun-202165.1 KiB1,7511,514

smenu.cH A D05-Jun-2021369.3 KiB11,4487,824

smenu.hH A D05-Jun-202123.5 KiB630429

smenu.spec.inH A D05-Jun-20211.2 KiB6049

usage.cH A D05-Jun-202111.8 KiB305265

usage.hH A D05-Jun-2021466 2815

utf8.cH A D05-Jun-202116.1 KiB562369

utf8.hH A D05-Jun-20211 KiB5834

utils.cH A D05-Jun-20217.9 KiB337208

utils.hH A D05-Jun-20211.2 KiB7245

versionH A D05-Jun-20217 21

xmalloc.cH A D05-Jun-20213.8 KiB178111

xmalloc.hH A D05-Jun-2021319 2617

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