root/trunk/curo/c/find_all_actions

Revision 278, 1.0 kB (checked in by depesz, 3 years ago)

Make it possible for action to specify that menu should ask for "enter" after running it (from menu, not from keypress).
Modify locks.sql accordingly, and mention that we need psql 8.3+ for \prompt

Line 
1 . ~/.curo/c/curo_mktemp
2
3 find_all_actions() {
4     tmp_file="$( curo_mktemp )"
5
6     while read sql_filename
7     do
8         action_name="$( basename "$sql_filename" .sql )"
9         dsc="$( sed -ne '1p' ~/.curo/s/"$action_name".sql )"
10         if [[ "${dsc:0:3}" == "-- " ]]
11         then
12             dsc="${dsc:3}"
13         else
14             dsc="$action_name"
15         fi
16         printf '%s|%s\n' "$dsc" "$action_name"
17     done < <(
18         find ~/.curo/s -type f -name '*.sql' | \
19             egrep -v '(setup|menu)\.sql$' | \
20             egrep -v '\.curo/s/.*/'
21         ) | sort > "$tmp_file"
22
23     r_find_all_actions_action=()
24     r_find_all_actions_name=()
25     r_find_all_actions_wait=()
26     i=0
27     while read line
28     do
29         r_find_all_actions_action[$i]="${line##*|}"
30         name="${line%%|*}"
31         if [[ "$name" != "${name%!menuwait}" ]]
32         then
33             r_find_all_actions_wait[$i]="wait"
34         fi
35         r_find_all_actions_name[$i]="${name%!menuwait}"
36         (( i++ ))
37     done < "$tmp_file"
38
39     rm -f "$tmp_file"
40 }
41
42 # vim: set ft=sh :
Note: See TracBrowser for help on using the browser.