aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtest_.lua80
1 files 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 @@
4local _ = require '_' 4local _ = require '_'
5 5
6 6
7D('Starting from the top.') 7I'Starting from the top.'
8 8
9local Help = [[ 9local Help = [[
10This is part of the blah blah blah... 10This is part of the blah blah blah...
@@ -16,37 +16,24 @@ local options =
16 start = 16 start =
17 { 17 {
18 help = 'Command to start the scanning process, for Sys V init.', 18 help = 'Command to start the scanning process, for Sys V init.',
19 value = false,
20 func = function(a, args, i)
21 end
22 }, 19 },
23 restart = {start}, 20 restart = {start},
24 ['force-reload'] = {start}, 21 ['force-reload'] = {start},
25 status = 22 status =
26 { 23 {
27 help = 'Command to check the status of the scanning process, for Sys V init.', 24 help = 'Command to check the status of the scanning process, for Sys V init.',
28 value = false,
29 func = function(a, args, i)
30 end
31 }, 25 },
32 stop = 26 stop =
33 { 27 {
34 help = 'Command to stop the scanning process, for Sys V init.', 28 help = 'Command to stop the scanning process, for Sys V init.',
35 value = false,
36 func = function(a, args, i)
37 end
38 }, 29 },
39 JACK = 30 JACK =
40 { 31 {
41 help = 'Command to start the JACK stuff, for users.', 32 help = 'Command to start the JACK stuff, for users.',
42 value = false,
43 func = function(a, args, i)
44 end
45 }, 33 },
46 STOP = 34 STOP =
47 { 35 {
48 help = 'Command to stop the JACK stuff, for users.', 36 help = 'Command to stop the JACK stuff, for users.',
49 value = false,
50 func = function(a, args, i) 37 func = function(a, args, i)
51--[=[ 38--[=[
52 _.killEmAll{'qsynth'} 39 _.killEmAll{'qsynth'}
@@ -76,7 +63,6 @@ local options =
76 help = 63 help =
77 { 64 {
78 help = 'Print help.', 65 help = 'Print help.',
79 value = false,
80 func = function(a, args, i) 66 func = function(a, args, i)
81 print(Help) 67 print(Help)
82 os.exit(0) 68 os.exit(0)
@@ -90,50 +76,86 @@ _.parseArgs(options, args)
90 76
91 77
92 78
79__[[
80 echo -n "This'll print forking later. "
81 date
82 sleep 2
83]]:log():show():fork('echo -n "later is "; date')
84print('')
85
86
93local GUI = 'qjackctl' 87local GUI = 'qjackctl'
94if _.runnable'catia' then GUI = 'catia' end 88if _.runnable'catia' then GUI = 'catia' end
95
96local speaker = 'espeak' 89local speaker = 'espeak'
97if _.runnable'espeak-ng' then speaker = 'espeak-ng' end 90if _.runnable'espeak-ng' then speaker = 'espeak-ng' end
91print('' .. GUI .. ' ' .. speaker)
92print('')
98 93
99 94for i,l in ipairs(__'free -h':log():Do().lines) do
100
101for i,l in ipairs(__'df -h':log():Do().lines) do
102 print(l) 95 print(l)
103end 96end
104print('') 97print('')
105 98
106__'df -h':log():also'free -h':show():Do() 99__'uname -a':log():also'free -h':show():Do()
100print('')
101
102for i,l in ipairs(__'uname -a\nfree -h':log():Do().lines) do
103 print(l)
104end
107print('') 105print('')
108 106
109for i,l in ipairs(__'df -h\nfree -h':log():Do().lines) do 107for i,l in ipairs(__{'uname -a', 'free -h'}:log():Do().lines) do
110 print(l) 108 print(l)
111end 109end
112print('') 110print('')
113 111
112
114__[[#!/bin/bash 113__[[#!/bin/bash
115 df -h 114 echo "Hello world from bash."
116 free -h
117]]:log():show():Do() 115]]:log():show():Do()
118print('') 116print('')
119 117
120for i,l in ipairs(__{'df -h', 'free -h'}:log():Do().lines) do 118__[[#!/usr/bin/env luajit
121 print(l) 119 print('Hello ' .. "world " .. [=[from]=] .. " Lua.")
122end 120]]:log():show():Do()
123print('') 121print('')
124 122
125print('' .. GUI .. ' ' .. speaker) 123__[[#!/usr/bin/perl
124 print "Hello world from perl.\n";
125]]:log():show():Do()
126print('')
127
128-- No idea why this isn't working.
129__[[#!/usr/bin/php
130<?php
131 print("Hello world from PHP.");
132?>
133]]:log():show():Do()
126print('') 134print('')
127 135
136-- Note no indent for Python, coz whitespace is significant.
137__[[#!/usr/bin/env python3
138print("Hello world from python.")
139]]:log():show():Do()
140print('')
141
142__[[#!/usr/bin/ruby
143 puts "Hello world from ruby."
144]]:log():show():Do()
145print('')
146
147
128print(__'true':log():show():Do().status) 148print(__'true':log():show():Do().status)
129print(__'false':log():show():Do().status) 149print(__'false':log():show():Do().status)
130print(__'exit 42':log():show():Do().status) 150print(__'exit 42':log():show():Do().status)
131print(__'return 42':log():show():Do().status) 151print(__'return 42':log():show():Do().status)
132print(__'command NoSuchCommand':log():show():Do().status) 152print(__'command NoSuchCommand':log():show():Do().status)
133 153
154
134--__'qpdfview':forkOnce() 155--__'qpdfview':forkOnce()
135--__'qpdfview':forkOnce() 156--__'qpdfview':forkOnce()
136 157
137 158
138D('debug?') 159__'date':log():show():Do()
139I('info?') 160__'date; sleep 5; date':log():show():Do()
161print('')