diff options
Diffstat (limited to '')
-rwxr-xr-x | test_.lua | 80 |
1 files changed, 51 insertions, 29 deletions
@@ -4,7 +4,7 @@ | |||
4 | local _ = require '_' | 4 | local _ = require '_' |
5 | 5 | ||
6 | 6 | ||
7 | D('Starting from the top.') | 7 | I'Starting from the top.' |
8 | 8 | ||
9 | local Help = [[ | 9 | local Help = [[ |
10 | This is part of the blah blah blah... | 10 | This 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') | ||
84 | print('') | ||
85 | |||
86 | |||
93 | local GUI = 'qjackctl' | 87 | local GUI = 'qjackctl' |
94 | if _.runnable'catia' then GUI = 'catia' end | 88 | if _.runnable'catia' then GUI = 'catia' end |
95 | |||
96 | local speaker = 'espeak' | 89 | local speaker = 'espeak' |
97 | if _.runnable'espeak-ng' then speaker = 'espeak-ng' end | 90 | if _.runnable'espeak-ng' then speaker = 'espeak-ng' end |
91 | print('' .. GUI .. ' ' .. speaker) | ||
92 | print('') | ||
98 | 93 | ||
99 | 94 | for i,l in ipairs(__'free -h':log():Do().lines) do | |
100 | |||
101 | for i,l in ipairs(__'df -h':log():Do().lines) do | ||
102 | print(l) | 95 | print(l) |
103 | end | 96 | end |
104 | print('') | 97 | print('') |
105 | 98 | ||
106 | __'df -h':log():also'free -h':show():Do() | 99 | __'uname -a':log():also'free -h':show():Do() |
100 | print('') | ||
101 | |||
102 | for i,l in ipairs(__'uname -a\nfree -h':log():Do().lines) do | ||
103 | print(l) | ||
104 | end | ||
107 | print('') | 105 | print('') |
108 | 106 | ||
109 | for i,l in ipairs(__'df -h\nfree -h':log():Do().lines) do | 107 | for i,l in ipairs(__{'uname -a', 'free -h'}:log():Do().lines) do |
110 | print(l) | 108 | print(l) |
111 | end | 109 | end |
112 | print('') | 110 | print('') |
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() |
118 | print('') | 116 | print('') |
119 | 117 | ||
120 | for 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.") |
122 | end | 120 | ]]:log():show():Do() |
123 | print('') | 121 | print('') |
124 | 122 | ||
125 | print('' .. GUI .. ' ' .. speaker) | 123 | __[[#!/usr/bin/perl |
124 | print "Hello world from perl.\n"; | ||
125 | ]]:log():show():Do() | ||
126 | print('') | ||
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() | ||
126 | print('') | 134 | print('') |
127 | 135 | ||
136 | -- Note no indent for Python, coz whitespace is significant. | ||
137 | __[[#!/usr/bin/env python3 | ||
138 | print("Hello world from python.") | ||
139 | ]]:log():show():Do() | ||
140 | print('') | ||
141 | |||
142 | __[[#!/usr/bin/ruby | ||
143 | puts "Hello world from ruby." | ||
144 | ]]:log():show():Do() | ||
145 | print('') | ||
146 | |||
147 | |||
128 | print(__'true':log():show():Do().status) | 148 | print(__'true':log():show():Do().status) |
129 | print(__'false':log():show():Do().status) | 149 | print(__'false':log():show():Do().status) |
130 | print(__'exit 42':log():show():Do().status) | 150 | print(__'exit 42':log():show():Do().status) |
131 | print(__'return 42':log():show():Do().status) | 151 | print(__'return 42':log():show():Do().status) |
132 | print(__'command NoSuchCommand':log():show():Do().status) | 152 | print(__'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 | ||
138 | D('debug?') | 159 | __'date':log():show():Do() |
139 | I('info?') | 160 | __'date; sleep 5; date':log():show():Do() |
161 | print('') | ||