root/trunk/curo/c/find_all_actions

Revision 268, 0.9 kB (checked in by depesz, 3 years ago)

initial commit. configurable, not yet all queries

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     i=0
26     while read line
27     do
28         r_find_all_actions_action[$i]="${line##*|}"
29         r_find_all_actions_name[$i]="${line%%|*}"
30         (( i++ ))
31     done < "$tmp_file"
32
33     rm -f "$tmp_file"
34 }
35
36 # vim: set ft=sh :
Note: See TracBrowser for help on using the browser.