From ad27e586d4c2b096ac00ba2440acd6a204b66179 Mon Sep 17 00:00:00 2001 From: dvs1 Date: Thu, 24 Oct 2024 12:35:26 +1000 Subject: Rewrite the test script to catch up with the newness. --- test_.lua | 80 ++++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/test_.lua b/test_.lua index 6784039..497b896 100755 --- a/test_.lua +++ b/test_.lua @@ -4,7 +4,7 @@ local _ = require '_' -D('Starting from the top.') +I'Starting from the top.' local Help = [[ This is part of the blah blah blah... @@ -16,37 +16,24 @@ 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'} @@ -76,7 +63,6 @@ local options = help = { help = 'Print help.', - value = false, func = function(a, args, i) print(Help) os.exit(0) @@ -90,50 +76,86 @@ _.parseArgs(options, args) +__[[ + 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(__'df -h':log():Do().lines) do +for i,l in ipairs(__'free -h':log():Do().lines) do print(l) end print('') -__'df -h':log():also'free -h':show():Do() +__'uname -a':log():also'free -h':show():Do() +print('') + +for i,l in ipairs(__'uname -a\nfree -h':log():Do().lines) do + print(l) +end print('') -for i,l in ipairs(__'df -h\nfree -h':log():Do().lines) do +for i,l in ipairs(__{'uname -a', 'free -h'}:log():Do().lines) do print(l) end print('') + __[[#!/bin/bash - df -h - free -h + echo "Hello world from bash." ]]:log():show():Do() print('') -for i,l in ipairs(__{'df -h', 'free -h'}:log():Do().lines) do - print(l) -end +__[[#!/usr/bin/env luajit + print('Hello ' .. "world " .. [=[from]=] .. " Lua.") +]]:log():show():Do() print('') -print('' .. GUI .. ' ' .. speaker) +__[[#!/usr/bin/perl + print "Hello world from perl.\n"; +]]:log():show():Do() +print('') + +-- No idea why this isn't working. +__[[#!/usr/bin/php + +]]:log():show():Do() print('') +-- Note no indent for Python, coz whitespace is significant. +__[[#!/usr/bin/env python3 +print("Hello world from python.") +]]:log():show():Do() +print('') + +__[[#!/usr/bin/ruby + puts "Hello world from ruby." +]]:log():show():Do() +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?') +__'date':log():show():Do() +__'date; sleep 5; date':log():show():Do() +print('') -- cgit v1.1