An operating system for CircuitPython devices
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

33 lines
979 B

import circuitos
import shlex
import console
class App(circuitos.App):
def F_main(self):
self.jump('prompt')
def F_prompt(self):
self.console.write(b'CicuitOS sh # ')
self.store['buf'] = []
self.jump('input')
def F_input(self):
raw_line = console.read(self.console, self.store['buf'])
if raw_line is not None:
line = shlex.split(raw_line.decode('ascii'))
if line:
try:
if line[0] == 'bg':
self.os.launch(*line[1:])
elif line[0] == 'exit':
self.exit()
else:
pid = self.os.launch(*line)
self.wait(pid)
self.transfer_console(pid)
except circuitos.AppNotFound as e:
print('error: app not found')
self.jump('prompt')
def F_loop(self):
pass