diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2020-04-23 16:55:15 -0600 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2020-04-23 16:55:23 -0600 |
commit | 0719df9d21334ad1415b5e9712bb343b884233ea (patch) | |
tree | 6e692243730a4b2f9534f90c14aa4729926fd34a /tools | |
parent | e15b5c6e6b35c08c90765776e37c50fb4c9d4f73 (diff) |
two small scripts to facilitate generating an annotated list of Lua scripts
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/luals | 26 | ||||
-rwxr-xr-x | tools/mkluacatalog | 41 |
2 files changed, 67 insertions, 0 deletions
diff --git a/tools/luals b/tools/luals new file mode 100755 index 0000000000..e55465733a --- /dev/null +++ b/tools/luals @@ -0,0 +1,26 @@ +#!/usr/bin/lua5.3 + +function scripts (path) + local out = io.popen ( + string.format ("find '%s' -maxdepth 1 -type f -iname \"[^_]*.lua\" | grep -ve s_", path) + ) + return function() + for file in out:lines() do + return file + end + return nil + end +end + +function ardour (v) + local newline = string.find (v['description'], '\n') + if newline then + io.write (string.format ("T:%s:N:%s:D:%s\n", v['type'], v['name'], string.sub (v['description'], 0, newline-1))) + else + io.write (string.format ("T:%s:N:%s:D:%s\n", v['type'], v['name'], v['description'])) + end +end + +for script in scripts ("share/scripts/") do + loadfile (script)() +end diff --git a/tools/mkluacatalog b/tools/mkluacatalog new file mode 100755 index 0000000000..fb702d1ab2 --- /dev/null +++ b/tools/mkluacatalog @@ -0,0 +1,41 @@ +#!/bin/sh + +tooldir=`dirname $0` + +$tooldir/luals | awk ' +BEGIN { + type_name_map["dsp"] = "DSP"; + type_name_map["EditorAction"] = "Editor Actions"; + type_name_map["EditorHook"] = "Editor Hooks"; + type_name_map["SessionInit"] = "Session Initialization"; + type_name_map["session"] = "Session"; +} +/T:/ { + split ($0, a, ":"); + + if (a[2] in type_name_map) { + type_name = type_name_map[a[2]]; + } else { + type_name = a[2]; + } + + types[scripts] = type_name; + type_names[type_name] = type_name; + names[scripts] = a[4]; + descriptions[scripts] = a[6]; + scripts++; +} +END { + tnc = asort (type_names); + + for (tn = 1; tn <= tnc; ++tn) { + printf ("<h2>%s</h2>\n<dl>\n", type_names[tn]); + for (s = 1; s <= scripts; ++s) { + if (types[s] == type_names[tn]) { + printf ("<dt>%s</dt><dd>%s<dd>\n", names[s], descriptions[s]); + } + } + printf ("</dl>\n"); + } +} +' |