#!/usr/bin/env luajit local _ = require '_' D('Starting from the top.') local Help = [[ This is part of the blah blah blah... ]] local options = { start = { help = 'Command to start the scanning process, for Sys V init.', value = false, func = function(a, args, i) end }, restart = {start}, ['force-reload'] = {start}, status = { help = 'Command to check the status of the scanning process, for Sys V init.', value = false, func = function(a, args, i) end }, stop = { help = 'Command to stop the scanning process, for Sys V init.', value = false, func = function(a, args, i) end }, JACK = { help = 'Command to start the JACK stuff, for users.', value = false, func = function(a, args, i) end }, STOP = { help = 'Command to stop the JACK stuff, for users.', value = false, func = function(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 }, help = { help = 'Print help.', value = false, func = function(a, args, i) print(Help) os.exit(0) end }, ['--help'] = {help}, } local args = {...} _.parseArgs(options, args) local GUI = 'qjackctl' if _.runnable'catia' then GUI = 'catia' end local speaker = 'espeak' if _.runnable'espeak-ng' then speaker = 'espeak-ng' end for i,l in ipairs(__'df -h':log():Do().lines) do print(l) end print('') __'df -h':log():also'free -h':show():Do() print('') for i,l in ipairs(__'df -h\nfree -h':log():Do().lines) do print(l) end print('') __[[#!/bin/bash df -h free -h ]]:log():show():Do() print('') for i,l in ipairs(__{'df -h', 'free -h'}:log():Do().lines) do print(l) end print('') print('' .. GUI .. ' ' .. speaker) print('') print(__'true':log():show():Do().status) print(__'false':log():show():Do().status) print(__'exit 42':log():show():Do().status) print(__'return 42':log():show():Do().status) print(__'command NoSuchCommand':log():show():Do().status) --__'qpdfview':forkOnce() --__'qpdfview':forkOnce() D('debug?') I('info?')