-
Notifications
You must be signed in to change notification settings - Fork 50
/
FAQ
70 lines (54 loc) · 2.89 KB
/
FAQ
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
Q: What is smenu?
A: smenu is a selection tool that acts as a filter that takes 'words'
from the standard input or a file and presents them on the screen in
various arrangements in a scrolling window.
A cursor that you can easily move allows you to select one or more
of them.
The selected 'words' are printed on the standard output.
--------
Q: Why smenu tells me: "The length of a 'word' has reached the limit of
512 characters." but there is no such 'word' in my entry?
A: It is likely that you have an unbalanced single or double quotation
mark somewhere. smenu uses quotation marks to be able to have spaces
in 'words', and quotation marks that are not used as delimiters must
be protected.
You can use something like: sed -e "s/'/\\\'/g" -e 's/"/\\"/g' to
pre-process the input in such a case.
Another solution is to ask smenu to treat quotation marks as normal
characters by using the -Q|-ignore_quotes option.
--------
Q: Why does smenu -C... no longer work?
A: smenu uses a new system of options based on the notion of contexts. The
-C parameter is only valid in the "Columns" context as indicated in the
error message.
The string '[-c|-col|-col_mode|-column>Columns]' that is printed
in the error message indicates that to switch to "Columns" mode
must use the -c parameter or its alternatives.
In this case the correct command line should contain something like:
smenu -c -C...
--------
Q: How to preserve the original alignment of the columns?
A: smenu merges multiple occurrences of word delimiters (' ' in the
example below) and so the original alignment of columns is lost.
One way to limit this loss is to replace the delimiter with a character
that does not appear in the input and is not a delimiter, we will use
'!' in the example, and tell smenu to replace it with a space with the
-S option.
Example of a session using the free command:
$ free
total used free shared buff/cache available
Mem: 23Gi 4,3Gi 1,6Gi 118Mi 18Gi 19Gi
Swap: 2,0Gi 0,0Ki 2,0Gi
$ free -h | smenu -c
total used free shared buff/cache available
Mem: 23Gi 4,3Gi 1,6Gi 118Mi 18Gi 19Gi
Swap: 2,0Gi 0,0Ki 2,0Gi
$ free -h | sed -e 's/ /!/g' -e 's/!\([^!]\)/ \1/g'
!!!!!!!!!!!!!! total!!!!!!! used!!!!!!! free!!!!! shared! buff/cache!! available
Mem:!!!!!!!!!!! 23Gi!!!!!! 4,3Gi!!!!!! 1,6Gi!!!!!! 120Mi!!!!!!! 18Gi!!!!!!! 19Gi
Swap:!!!!!!!!! 2,0Gi!!!!!! 0,0Ki!!!!!! 2,0Gi
$ free -h | sed -e 's/ /!/g' -e 's/!\([^!]\)/ \1/g' | smenu -c -S'/!/ /g'
############### total used free shared buff/cache available
Mem: 23Gi 4,3Gi 1,6Gi 118Mi 18Gi 19Gi
Swap: 2,0Gi 0,0Ki 2,0Gi
Where ############### is the smenu cursor.