From aba4df21e99345028d8de13a376ae3312472ce63 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Mon, 25 Nov 2024 03:25:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=8E=A7=E5=88=B6=E5=8F=B0?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E5=90=AF=E5=8A=A8=E6=B5=81=E7=A8=8B=20?= =?UTF-8?q?=E6=A1=86=E6=9E=B6=E8=B7=9F=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zenitha | 2 +- shell.lua | 101 +++++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 82 insertions(+), 21 deletions(-) diff --git a/Zenitha b/Zenitha index ce22dfac..f40a2837 160000 --- a/Zenitha +++ b/Zenitha @@ -1 +1 @@ -Subproject commit ce22dfaccd26762673319f75d17a2cc52a1bf1b9 +Subproject commit f40a2837ea9478897d2655199749f2eb96682486 diff --git a/shell.lua b/shell.lua index 266bd439..b765ae1d 100644 --- a/shell.lua +++ b/shell.lua @@ -5,6 +5,7 @@ function simpRequire(path) end local _require=require local require=simpRequire('Zenitha.') +local rnd=math.random STRING=require'stringExtend' TABLE=require'tableExtend' AE=require'escape' @@ -23,20 +24,26 @@ local function sleep(time) end end local function feed(...) + local lastText=0 local d={...} for i=1,#d do if type(d[i])=='number' then - sleep(d[i]) - else + if d[i]>0 then + sleep(d[i]) + elseif d[i]==-1 then + write(("\b"):rep(#lastText)) + end + elseif type(d[i])=='string' then write(d[i]) + lastText=d[i] + else + error() end end end local rArg=TABLE.sub(arg,(arg[-2]=='love' or arg[-1]=='love') and 2 or 1) -for k,v in next,rArg do print(k,v)end - local option={} local commands={} @@ -58,20 +65,27 @@ function commands.version() sleep(.1) print(("TechOS %s (%s)"):format(_require'version'.appVer,_require'version'.verCode)) end -function commands.shell() +function commands.shell(startArg) feed( - .000,AE[425].. " _____ _ _ "..AE._d" _ "..AE[005].." _____ _", - .260,AE[425].."\n|_ _|___ ___| |_ _____|_|___ ___ "..AE._d" |_| "..AE[005].." | __|___| |___ _ _ _ _", - .120,AE[425].."\n | | | -_| _| | | | | . | "..AE._d" _ "..AE[005].." | | | .'| | .'|_'_| | |", - .120,AE[425].."\n |_| |___|___|_|_|_|_|_|_|_|_|___| "..AE._d" |_| "..AE[005].." |_____|__,|_|__,|_,_|_ |", - .120,AE[533].."\n The ultra-improved version of Techmino, for YOU."..AE[005].. " |___|", - .620,AE.."\n\nWelcome to the TechOS shell!\n",.260 + .000,AE[425].. " _____ _ _ "..AE._d" _ "..AE[115].." _____ _", + .260,AE[425].."\n|_ _|___ ___| |_ _____|_|___ ___ "..AE._d" |_| "..AE[115].." | __|___| |___ _ _ _ _", + .120,AE[425].."\n | | | -_| _| | | | | . | "..AE._d" _ "..AE[115].." | | | .'| | .'|_'_| | |", + .120,AE[425].."\n |_| |___|___|_|_|_|_|_|_|_|_|___| "..AE._d" |_| "..AE[115].." |_____|__,|_|__,|_,_|_ |", + .120,AE[533].."\n The ultra-improved version of Techmino, for YOU."..AE[115].. " |___|", + .620,AE.."\n\nWelcome to TechOS shell!\n",.260 ) + local input while true do - write("\n> ") - local input=io.read() + if startArg and startArg[1] then + input=table.concat(startArg," ") + write("\n> "..input.."\n") + startArg=nil + else + write("\n> ") + input=io.read() + end if input~='' then - local args=STRING.split(input,' ') + local args=STRING.split(input," ") if args[1]=='help' then feed( "Available Commands:\n", @@ -80,13 +94,60 @@ function commands.shell() "exit Interrupt booting process and exit shell\n" ) elseif args[1]=='start' then - if args[2]=='app' then - option.launchApplet=args[3] - end - feed(.1,"Starting application...\n",.1) + if args[2]=='app' then option.launchApplet=args[3] end + math.randomseed(os.time()) + local function OK(n) return AE.U[n].."\r[ "..AE._G"OK"..AE.NL[n] end + feed(.1, + "[ ] Finding boot device\n", .1, + ">zde0n1p1 zde0n1p2\n",.1, + OK(2),.1, + "[ ] Launching bootloader\n", .1, + ">Zeta_loader\n",.1, + OK(2),.1, + "[ ] Running bootloader\n", rnd()*.2,OK(1),.1, + "[ ] Initializing root-device\n", rnd()*.2,OK(1),.1, + "[ ] Mounting kernal config\n", rnd()*.2,OK(1),.1, + "[ ] Loading kernel variables\n", rnd()*.2,OK(1),.1, + "[ ] Initializing root-fs\n", rnd()*.2,OK(1),.1, + "[ ] Initializing user-fs\n", rnd()*.2,OK(1),.1, + "[ ] Initializing probes\n", rnd()*.2, + " ".. rnd(20,26).."/260 probes initialized\n",rnd()*.1, + AE.PL..(" "..rnd(35,42) )..AE.NL,rnd()*.1, + AE.PL..(" "..rnd(62,94) )..AE.NL,rnd()*.1, + AE.PL..( rnd(126,162))..AE.NL,rnd()*.1, + AE.PL..( rnd(200,226))..AE.NL,rnd()*.1, + AE.PL..( rnd(242,256))..AE.NL,rnd()*.1, + AE.PL..( 260 )..AE.NL,.2, + OK(2),.1, + "[ ] Establishing direct neurolink\n",.1, + "0/8 lobes connected\n",rnd(26,42)/100, + AE.PL..(1)..AE.NL,rnd()*.1, + AE.PL..(2)..AE.NL,rnd()*.1, + AE.PL..(3)..AE.NL,rnd()*.1, + AE.PL..(4)..AE.NL,rnd()*.1, + AE.PL..(5)..AE.NL,rnd()*.1, + AE.PL..(6)..AE.NL,rnd()*.1, + AE.PL..(7)..AE.NL,rnd()*.1, + AE.PL..(8)..AE.NL,rnd()*.1, + OK(2),.1, + "[ ] Get direct brain access\n", .1, + "Collecting base signal\n", .06, + "Calibrating signal strength\n", .04, + "Decoding signal pattern\n", .12, + "Transfering authority\n", .06, + "Creating middle layer\n", .06, + OK(6),.1, + "[ ] Starting audio manager\n", .1, + "Building virtual audio mixing space\n", .02, + "Initializing sound simulating system\n",.04, + "Seting up objects in space\n", .06, + OK(4),.1, + "[ ] Starting display manager\n", .1, + OK(1),.2,"\n" + ) break elseif args[1]=='exit' then - print("Exiting shell...") + feed("Exiting shell...",.3,"\n") option.bootDisabled=true break else @@ -103,7 +164,7 @@ end if rArg[1]=="-h" or rArg[1]=="--help" then commands.help() elseif rArg[1]=='-s' or rArg[1]=='--shell' then - commands.shell() + commands.shell(TABLE.sub(rArg,2)) elseif rArg[1]=='-v' or rArg[1]=='--version' then commands.version() elseif rArg[1] then