-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlsh.lua
46 lines (37 loc) · 793 Bytes
/
lsh.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function host ()
line = io.popen('hostname'):read('*l')
print(line)
end
function lfetch ()
dofile('lfetch.lua')
end
function name ()
dofile('osname.lua')
end
function help ()
dofile('help')
end
function battery ()
percent = io.popen('cat /sys/class/power_supply/BAT1/capacity'):read('*l')
print(percent)
state = io.popen('cat /sys/class/power_supply/BAT1/status'):read('*l')
print(state)
end
--function subshell ()
--sh = io.popen('sh'):read('*l')
--print(sh)
--end
print("lsh - type \"help\" for a list of commands press Ctrl+C to exit")
while true do
a = io.read()
if a == "hostname" then host()
end
if a == "lfetch" then lfetch()
end
if a == "name" then name()
end
if a == "help" then help()
end
if a == "pwr" then battery()
end
end