#!/usr/bin/env luajit if type(jit) == 'table' then print(arg[0] .. ' is being run by ' .. jit.version .. ' under ' .. jit.os .. ' on a ' .. jit.arch .. '. Lua version ' .. _VERSION) else print(arg[0] .. ' is being run by Lua version ' .. _VERSION) end local _ = require 'PolygLua' I'Starting from the top.' Help = [[ This is part of the blah blah blah... ]] Version = '0.0 crap' local options = { start = {help = 'Command to start the scanning process, for Sys V init.', value = 'blah'}, -- restart = {start}, -- ['force-reload'] = {start}, status = {help = 'Command to check the status of the scanning process, for Sys V init.',}, stop = {help = 'Command to stop the scanning process, for Sys V init.',}, JACK = {help = 'Command to start the JACK stuff, for users.',}, STOP = {help = 'Command to stop the JACK stuff, for users.', func = function(self, options, a, args, i) --[=[ _.killEmAll{'qsynth'} __[[ a2j_control --stop sleep 2 a2j_control --exit sleep 2 ]]:Do() _.killEmAll{'alsa_in', 'alsa_out', 'zita-a2j', 'zita-j2a', 'aseqjoy', 'jack-plumbing'} __[[ sleep 2 jack_control stop sleep 2 jack_control exit sleep 2 ]]:Do() _.killEmAll{'jmcore', 'qjackctl'} -- Catia is python, and no easy way to kill it. -- Also it keeps jackdbus alive, no matter how hard you kill it. __'pkill -TERM -u $USER -f catia':Do() __'sleep 2':Do() _.killEmAll{'jackdbus', 'a2jmidid'} ]=] end }, } options['restart'] = options['start'] options['force-reload'] = options['start'] print('start = ' .. options.start.value) _.parse(arg, options, 'test_') print('start = ' .. options.start.value) print('stop = ' .. options.stop.value) __[[ echo -n "This'll print forking later. " date sleep 2 ]]:log():show():fork('echo -n "later is "; date') print('') local GUI = 'qjackctl' if _.runnable'catia' then GUI = 'catia' end local speaker = 'espeak' if _.runnable'espeak-ng' then speaker = 'espeak-ng' end print('' .. GUI .. ' ' .. speaker) print('') for i,l in ipairs(__'free -h':log():Do().lines) do print(l) end print('') for i,l in ipairs(__'uname -a\nfree -h':log():Do().lines) do print(l) end print('') __'uname -a':log():Then'free -h':show():Do() print('') __{'uname -a', 'free -h'}:log():show():Do() print('') print(__[[#!/bin/NoSuchCommand echo "Should not print." ]]:log():show():Do().status) print('') __[[#!/bin/bash echo "G'day world from bash." ]]:log():show():Do() print('') print(__[[#!/usr/bin/tcc -run #include int main() { printf("G'day world from C.\n"); return 1; } ]]:log():show():Do().status) print('') __[[#!/usr/bin/env luajit print("G'day " .. "world " .. [=[from]=] .. ' Lua.') ]]:log():show():Do() print('') __[[#!/usr/bin/perl print "G'day world from perl.\n"; ]]:log():show():Do() print('') __[[#!/usr/bin/env php