console.print
This commit is contained in:
parent
63c5ad520d
commit
133cf044c4
|
@ -11,9 +11,9 @@ def get_app_class(template):
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
try:
|
try:
|
||||||
os.listdir(file)
|
os.listdir(file)
|
||||||
console.write_str(self.console, f"cat: {file}: Is a directory\n")
|
console.print(self.console, f"cat: {file}: Is a directory")
|
||||||
except OSError:
|
except OSError:
|
||||||
console.write_str(self.console, f"cat: {file}: No such file or directory\n")
|
console.print(self.console, f"cat: {file}: No such file or directory")
|
||||||
|
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,9 @@ def get_app_class(template):
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
try:
|
try:
|
||||||
os.listdir(file)
|
os.listdir(file)
|
||||||
console.write_str(self.console, f"grep: {file}: Is a directory\n")
|
console.print(self.console, f"grep: {file}: Is a directory")
|
||||||
except OSError:
|
except OSError:
|
||||||
console.write_str(self.console, f"grep: {file}: No such file or directory\n")
|
console.print(self.console, f"grep: {file}: No such file or directory")
|
||||||
|
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
|
|
|
@ -11,13 +11,13 @@ def get_app_class(template):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for file in os.listdir(path):
|
for file in os.listdir(path):
|
||||||
console.write_str(self.console, file + "\n")
|
console.print(self.console, file)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
try:
|
try:
|
||||||
os.stat(path)
|
os.stat(path)
|
||||||
console.write_str(self.console, path + "\n")
|
console.print(self.console, path)
|
||||||
except OSError:
|
except OSError:
|
||||||
console.write_str(self.console, f"ls: cannot access '{path}': No such file or directory\n")
|
console.print(self.console, f"ls: cannot access '{path}': No such file or directory")
|
||||||
|
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ def get_app_class(template):
|
||||||
for pid, app in apps.items():
|
for pid, app in apps.items():
|
||||||
args = app.argv[1:]
|
args = app.argv[1:]
|
||||||
name = app.name
|
name = app.name
|
||||||
console.write_str(self.console, f'{pid} {name} {args}\n')
|
console.print(self.console, f'{pid} {name} {args}')
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
return App
|
return App
|
||||||
|
|
|
@ -4,7 +4,7 @@ import console
|
||||||
def get_app_class(template):
|
def get_app_class(template):
|
||||||
class App(template):
|
class App(template):
|
||||||
def F_main(self):
|
def F_main(self):
|
||||||
console.write_str(self.console, os.getcwd() + "\n")
|
console.print(self.console, os.getcwd())
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
return App
|
return App
|
||||||
|
|
|
@ -8,7 +8,7 @@ def get_app_class(template):
|
||||||
self.jump('prompt')
|
self.jump('prompt')
|
||||||
|
|
||||||
def F_prompt(self):
|
def F_prompt(self):
|
||||||
self.console.write(b'FibonacciOS sh # ')
|
console.print(self.console, 'FibonacciOS sh # ', end="")
|
||||||
self.store['buf'] = []
|
self.store['buf'] = []
|
||||||
self.jump('input')
|
self.jump('input')
|
||||||
|
|
||||||
|
@ -29,9 +29,7 @@ def get_app_class(template):
|
||||||
self.wait(pid)
|
self.wait(pid)
|
||||||
self.transfer_console(pid)
|
self.transfer_console(pid)
|
||||||
except fibonaccios.exceptions.AppNotFound as e:
|
except fibonaccios.exceptions.AppNotFound as e:
|
||||||
print('error: app not found')
|
console.print(self.console, 'error: app not found')
|
||||||
self.jump('prompt')
|
self.jump('prompt')
|
||||||
|
|
||||||
def F_loop(self):
|
|
||||||
pass
|
|
||||||
return App
|
return App
|
||||||
|
|
|
@ -19,3 +19,6 @@ def read(console, buffer):
|
||||||
|
|
||||||
def write_str(console, string, encoding="utf-8"):
|
def write_str(console, string, encoding="utf-8"):
|
||||||
console.write(string.encode(encoding))
|
console.write(string.encode(encoding))
|
||||||
|
|
||||||
|
def print(console, *values, sep=" ", end="\n"):
|
||||||
|
write_str(console, sep.join(str(value) for value in values) + end)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user