fb:porticula NoPaste
MilkRun (initial test)
Uploader: | MilkFreeze |
Datum/Zeit: | 13.06.2011 14:30:42 |
#include "list.bi"
makelist(string,string)
dim path as string
dim path_list as string_list
dim cmd as string
dim cmd_list as string_list
open pipe "echo $PATH" for input as #1
input #1, path
close #1
while (path <> "" and instr(path, ":") > 0)
path_list.append(left(path, instr(path, ":") -1) + "/")
path = mid(path, instr(path, ":") +1)
wend
for i as integer = 1 to path_list.count()
open pipe "ls "& path_list.item(i) &" --color=never" for input as #2
while not eof(2)
input #2, cmd
if cmd <> "" then
cmd_list.append(cmd)
end if
wend
close #2
next
dim x as integer
dim i as integer
dim key as string
dim hints(5) as string
dim hit as integer = 1
do
sleep
cls
key = inkey
select case asc(key)
case 8
cmd = left(cmd, len(cmd) -1)
hit = 1
case 13
shell "nohup " & cmd_list.item(hit)
case 255
if asc( key,2) = 77 then
hit += 1
cmd = cmd_list.item(hit)
elseif asc(key,2) = 75 then
hit -= 1
cmd = cmd_list.item(hit)
end if
case else
cmd += key
end select
? cmd
for i = hit to cmd_list.count()
if left(cmd_list.item(i),len(cmd)) = cmd then
hit = i
for x = 0 to 4
hints(x) = cmd_list.item(hit + x)
next
exit for
end if
next
? ">" & hints(0) & "< ";
for i = 1 to 4
? hints(i) &" ";
next
?
loop