Browse Source

Revamp eedmenu to be more flexible

eedmenu now does not use special parameter for ini reading.  INI can be
used but we expect user to send it on STDIN (probably using eeini) just
as any other (delimited) file.
Alois Mahdal 10 years ago
parent
commit
3312ab6ece
1 changed files with 9 additions and 17 deletions
  1. 9
    17
      bin/eedmenu.in

+ 9
- 17
bin/eedmenu.in View File

7
 FFOO_INI_PATH="__FFOO_INI_PATH__"
7
 FFOO_INI_PATH="__FFOO_INI_PATH__"
8
 
8
 
9
 usage() {
9
 usage() {
10
-    usage_is "[-l|--lines] [-d|--delim] [-e|--read-eeini]"
10
+    usage_is "[-l|--lines NUM] [-s|--split CHAR]"
11
 }
11
 }
12
 
12
 
13
 numbered=false
13
 numbered=false
14
 lines=10
14
 lines=10
15
-maybe_cut=cat
16
-maybe_read_eeini=cat
15
+maybe_split=cat
17
 
16
 
18
 while true; do case $1 in
17
 while true; do case $1 in
19
-    -l|--lines)         lines=$2;                   shift 2 ;;
20
-    -d|--delim)         delim=$2;                   shift 2 ;;
21
-    -e|--read-eeini)    read_eeini=$2; delim='=';   shift 2 ;;
22
-    "")                 break                               ;;
18
+    -l|--lines)         lines=$2; shift 2 ;;
19
+    -s|--split)         delim=$2; shift 2 ;;
20
+    "")                 break             ;;
23
     *)  usage
21
     *)  usage
24
 esac done
22
 esac done
25
 
23
 
26
-test -n "$delim"        && maybe_cut=do_cut
27
-test -n "$read_eeini"   && maybe_read_eeini=do_read_eeini
24
+test -n "$delim"        && maybe_split=do_split
28
 
25
 
29
 host=$(hostname -s)
26
 host=$(hostname -s)
30
 nb="$(iniread -p style.color.nbg)"
27
 nb="$(iniread -p style.color.nbg)"
40
 arg_fn="${fn:+-fn $fn}"
37
 arg_fn="${fn:+-fn $fn}"
41
 style="$arg_nb $arg_nf $arg_sb $arg_sf $arg_fn"
38
 style="$arg_nb $arg_nf $arg_sb $arg_sf $arg_fn"
42
 
39
 
43
-do_cut() {
40
+do_split() {
44
     cut -d$delim -f2-
41
     cut -d$delim -f2-
45
 }
42
 }
46
 
43
 
47
-do_read_eeini() {
48
-    iniread $read_eeini
49
-}
50
-
51
-$maybe_read_eeini \
52
-  | dmenu -l $lines $style \
53
-  | $maybe_cut
44
+dmenu -l $lines $style \
45
+  | $maybe_split