summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2014-03-07 15:11:30 +0000
committerTom Hacohen <tom@stosb.com>2014-03-07 15:11:30 +0000
commite63a5cc903e356612c5d55ce4e39f93b0e0a521a (patch)
tree0b8c7e61eb5b9a705bcc79684db1fa2721eccfde /src
parent84e9eba24f08faf62625b4ccce1385f13bd68a5f (diff)
Eet: Added vieet a tool to edit eet files.
This tool lets you just open an eet file for editing directly, by wrapping around 'eet' and the preferred editor defined in the env var 'EDITOR'. @feature
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Eet.am1
-rwxr-xr-xsrc/bin/eet/vieet59
2 files changed, 60 insertions, 0 deletions
diff --git a/src/Makefile_Eet.am b/src/Makefile_Eet.am
index 05e9acb197..b8540f511e 100644
--- a/src/Makefile_Eet.am
+++ b/src/Makefile_Eet.am
@@ -37,6 +37,7 @@ EXTRA_DIST += static_libs/lz4/README
37### Binary 37### Binary
38 38
39bin_PROGRAMS += bin/eet/eet 39bin_PROGRAMS += bin/eet/eet
40bin_SCRIPTS += bin/eet/vieet
40 41
41bin_eet_eet_SOURCES = bin/eet/eet_main.c 42bin_eet_eet_SOURCES = bin/eet/eet_main.c
42 43
diff --git a/src/bin/eet/vieet b/src/bin/eet/vieet
new file mode 100755
index 0000000000..8c38a10300
--- /dev/null
+++ b/src/bin/eet/vieet
@@ -0,0 +1,59 @@
1#!/bin/sh
2
3function cleanup() {
4 if [ ! -z "$TFILE" ]; then
5 rm "$TFILE"
6 fi
7}
8
9function die() {
10 echo "$@"
11 echo "Aborting"
12 cleanup
13 exit 1
14}
15
16function usage() {
17 die "Usage: vieet <eet file> <section>"
18}
19
20if [ $# -ne 2 ]; then
21 usage
22fi
23
24if [[ -z "$EDITOR" ]]; then
25 die "EDITOR env var must be set."
26fi
27
28EETFILE="$1"
29SECTION="$2"
30TFILE=$(mktemp)
31
32if [ $? -ne 0 ]; then
33 die "Failed creating tempfile."
34fi
35
36# Decode the file
37eet -d "$EETFILE" "$SECTION" "$TFILE"
38
39if [ $? -ne 0 ]; then
40 die "Failed decoding eet file."
41fi
42
43DONE=0
44
45while [ $DONE -ne 1 ]
46do
47 $EDITOR $TFILE
48
49 eet -e "$EETFILE" "$SECTION" "$TFILE" 1
50 if [ $? -ne 0 ]; then
51 echo "Failed compiling eet file."
52 echo "Press 'Return' to reopen the editor, or ^C to abort."
53 read
54 else
55 DONE=1
56 fi
57done
58
59cleanup