diff options
author | onefang | 2025-05-28 10:42:37 +1000 |
---|---|---|
committer | onefang | 2025-05-28 10:42:37 +1000 |
commit | 298d75d46ba6bd26646c9c6a51aa0c932fadeb33 (patch) | |
tree | 913519a0e25f7a6c40d81aafae14145d98434102 /test_.lua | |
parent | Neaten up the white space. (diff) | |
download | JackOnAllDevices-298d75d46ba6bd26646c9c6a51aa0c932fadeb33.zip JackOnAllDevices-298d75d46ba6bd26646c9c6a51aa0c932fadeb33.tar.gz JackOnAllDevices-298d75d46ba6bd26646c9c6a51aa0c932fadeb33.tar.bz2 JackOnAllDevices-298d75d46ba6bd26646c9c6a51aa0c932fadeb33.tar.xz |
Diffstat (limited to 'test_.lua')
-rwxr-xr-x | test_.lua | 186 |
1 files changed, 0 insertions, 186 deletions
diff --git a/test_.lua b/test_.lua deleted file mode 100755 index 9e1931a..0000000 --- a/test_.lua +++ /dev/null | |||
@@ -1,186 +0,0 @@ | |||
1 | #!/usr/bin/env luajit | ||
2 | |||
3 | if type(jit) == 'table' then | ||
4 | print(arg[0] .. ' is being run by ' .. jit.version .. ' under ' .. jit.os .. ' on a ' .. jit.arch .. '. Lua version ' .. _VERSION) | ||
5 | else | ||
6 | print(arg[0] .. ' is being run by Lua version ' .. _VERSION) | ||
7 | end | ||
8 | |||
9 | |||
10 | local _ = require 'PolygLua' | ||
11 | |||
12 | |||
13 | I'Starting from the top.' | ||
14 | |||
15 | Help = [[ | ||
16 | This is part of the blah blah blah... | ||
17 | ]] | ||
18 | |||
19 | Version = '0.0 crap' | ||
20 | |||
21 | local options = | ||
22 | { | ||
23 | start = {help = 'Command to start the scanning process, for Sys V init.', value = 'blah'}, | ||
24 | -- restart = {start}, | ||
25 | -- ['force-reload'] = {start}, | ||
26 | status = {help = 'Command to check the status of the scanning process, for Sys V init.',}, | ||
27 | stop = {help = 'Command to stop the scanning process, for Sys V init.',}, | ||
28 | JACK = {help = 'Command to start the JACK stuff, for users.',}, | ||
29 | STOP = {help = 'Command to stop the JACK stuff, for users.', | ||
30 | func = function(self, options, a, args, i) | ||
31 | --[=[ | ||
32 | _.killEmAll{'qsynth'} | ||
33 | __[[ | ||
34 | a2j_control --stop | ||
35 | sleep 2 | ||
36 | a2j_control --exit | ||
37 | sleep 2 | ||
38 | ]]:Do() | ||
39 | _.killEmAll{'alsa_in', 'alsa_out', 'zita-a2j', 'zita-j2a', 'aseqjoy', 'jack-plumbing'} | ||
40 | __[[ | ||
41 | sleep 2 | ||
42 | jack_control stop | ||
43 | sleep 2 | ||
44 | jack_control exit | ||
45 | sleep 2 | ||
46 | ]]:Do() | ||
47 | _.killEmAll{'jmcore', 'qjackctl'} | ||
48 | -- Catia is python, and no easy way to kill it. | ||
49 | -- Also it keeps jackdbus alive, no matter how hard you kill it. | ||
50 | __'pkill -TERM -u $USER -f catia':Do() | ||
51 | __'sleep 2':Do() | ||
52 | _.killEmAll{'jackdbus', 'a2jmidid'} | ||
53 | ]=] | ||
54 | end | ||
55 | }, | ||
56 | install = | ||
57 | { | ||
58 | help = 'Command to install aataaj.lua', | ||
59 | func = function(self, options, a, args, i) | ||
60 | local w = __[[whoami]]:noErr():Do().lines[1] | ||
61 | local d = __[[pwd]]:noErr():Do().lines[1] | ||
62 | if 'root' ~= w then | ||
63 | E'Need to be root user to install.' | ||
64 | else | ||
65 | print('INSTALLING!!!') | ||
66 | __[[#!/bin/bash | ||
67 | echo "Installing PolygLua" | ||
68 | ./PolygLua.lua -vvvv | ||
69 | ]]:log():show():Do() | ||
70 | end | ||
71 | os.exit(0) | ||
72 | end | ||
73 | }, | ||
74 | } | ||
75 | options['restart'] = options['start'] | ||
76 | options['force-reload'] = options['start'] | ||
77 | |||
78 | print('start = ' .. options.start.value) | ||
79 | _.parse(arg, options, 'test_') | ||
80 | print('start = ' .. options.start.value) | ||
81 | print('stop = ' .. options.stop.value) | ||
82 | |||
83 | |||
84 | |||
85 | __[[ | ||
86 | echo -n "This'll print forking later. " | ||
87 | date | ||
88 | sleep 2 | ||
89 | ]]:log():show():fork('echo -n "later is "; date') | ||
90 | print('') | ||
91 | |||
92 | |||
93 | local GUI = 'qjackctl' | ||
94 | if _.runnable'catia' then GUI = 'catia' end | ||
95 | local speaker = 'espeak' | ||
96 | if _.runnable'espeak-ng' then speaker = 'espeak-ng' end | ||
97 | print('' .. GUI .. ' ' .. speaker) | ||
98 | print('') | ||
99 | |||
100 | for i,l in ipairs(__'free -h':log():Do().lines) do | ||
101 | print(l) | ||
102 | end | ||
103 | print('') | ||
104 | |||
105 | for i,l in ipairs(__'uname -a\nfree -h':log():Do().lines) do | ||
106 | print(l) | ||
107 | end | ||
108 | print('') | ||
109 | |||
110 | __'uname -a':log():Then'free -h':show():Do() | ||
111 | print('') | ||
112 | |||
113 | __{'uname -a', 'free -h'}:log():show():Do() | ||
114 | print('') | ||
115 | |||
116 | |||
117 | print(__[[#!/bin/NoSuchCommand | ||
118 | echo "Should not print." | ||
119 | ]]:log():show():Do().status) | ||
120 | print('') | ||
121 | |||
122 | __[[#!/bin/bash | ||
123 | echo "G'day world from bash." | ||
124 | ]]:log():show():Do() | ||
125 | print('') | ||
126 | |||
127 | print(__[[#!/usr/bin/tcc -run | ||
128 | #include <tcclib.h> | ||
129 | |||
130 | int main() | ||
131 | { | ||
132 | printf("G'day world from C.\n"); | ||
133 | return 1; | ||
134 | } | ||
135 | ]]:log():show():Do().status) | ||
136 | print('') | ||
137 | |||
138 | __[[#!/usr/bin/env luajit | ||
139 | print("G'day " .. "world " .. [=[from]=] .. ' Lua.') | ||
140 | ]]:log():show():Do() | ||
141 | print('') | ||
142 | |||
143 | __[[#!/usr/bin/perl | ||
144 | print "G'day world from perl.\n"; | ||
145 | ]]:log():show():Do() | ||
146 | print('') | ||
147 | |||
148 | __[[#!/usr/bin/env php | ||
149 | <?php | ||
150 | print("G'day world from php.\n"); | ||
151 | ]]:log():show():Do() | ||
152 | print('') | ||
153 | |||
154 | -- Note no indent for Python, coz whitespace is significant. | ||
155 | __[[#!/usr/bin/env python3 | ||
156 | print("G'day world from python.") | ||
157 | ]]:log():show():Do() | ||
158 | print('') | ||
159 | |||
160 | __[[#!/usr/bin/ruby | ||
161 | puts "G'day world from ruby." | ||
162 | ]]:log():show():Do() | ||
163 | print('') | ||
164 | |||
165 | |||
166 | print(__'true':log():show():Do().status) | ||
167 | print(__'false':log():show():Do().status) | ||
168 | print(__'exit 42':log():show():Do().status) | ||
169 | print(__'return 42':log():show():Do().status) | ||
170 | print(__'command NoSuchCommand':log():show():Do().status) | ||
171 | |||
172 | |||
173 | --__'qpdfview':forkOnce() | ||
174 | --__'qpdfview':forkOnce() | ||
175 | |||
176 | print('') | ||
177 | |||
178 | for i,a in ipairs(arg) do print('arg[' .. i .. '] = ' .. a) end | ||
179 | print('') | ||
180 | for k,a in pairs(arg) do print('arg[' .. k .. '] = ' .. a) end | ||
181 | |||
182 | __'date':log():show():Do() | ||
183 | -- Should get that "later" thing printed while the sleep is happening. | ||
184 | __'date; sleep 5; date':log():show():Do() | ||
185 | |||
186 | |||