console.print
This commit is contained in:
parent
63c5ad520d
commit
133cf044c4
|
@ -11,9 +11,9 @@ def get_app_class(template):
|
|||
except OSError as e:
|
||||
try:
|
||||
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:
|
||||
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()
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ def get_app_class(template):
|
|||
except OSError as e:
|
||||
try:
|
||||
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:
|
||||
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()
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@ def get_app_class(template):
|
|||
|
||||
try:
|
||||
for file in os.listdir(path):
|
||||
console.write_str(self.console, file + "\n")
|
||||
console.print(self.console, file)
|
||||
except OSError as e:
|
||||
try:
|
||||
os.stat(path)
|
||||
console.write_str(self.console, path + "\n")
|
||||
console.print(self.console, path)
|
||||
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()
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ def get_app_class(template):
|
|||
for pid, app in apps.items():
|
||||
args = app.argv[1:]
|
||||
name = app.name
|
||||
console.write_str(self.console, f'{pid} {name} {args}\n')
|
||||
console.print(self.console, f'{pid} {name} {args}')
|
||||
self.exit()
|
||||
|
||||
return App
|
||||
|
|
|
@ -4,7 +4,7 @@ import console
|
|||
def get_app_class(template):
|
||||
class App(template):
|
||||
def F_main(self):
|
||||
console.write_str(self.console, os.getcwd() + "\n")
|
||||
console.print(self.console, os.getcwd())
|
||||
self.exit()
|
||||
|
||||
return App
|
||||
|
|
|
@ -8,7 +8,7 @@ def get_app_class(template):
|
|||
self.jump('prompt')
|
||||
|
||||
def F_prompt(self):
|
||||
self.console.write(b'FibonacciOS sh # ')
|
||||
console.print(self.console, 'FibonacciOS sh # ', end="")
|
||||
self.store['buf'] = []
|
||||
self.jump('input')
|
||||
|
||||
|
@ -29,9 +29,7 @@ def get_app_class(template):
|
|||
self.wait(pid)
|
||||
self.transfer_console(pid)
|
||||
except fibonaccios.exceptions.AppNotFound as e:
|
||||
print('error: app not found')
|
||||
console.print(self.console, 'error: app not found')
|
||||
self.jump('prompt')
|
||||
|
||||
def F_loop(self):
|
||||
pass
|
||||
return App
|
||||
|
|
|
@ -19,3 +19,6 @@ def read(console, buffer):
|
|||
|
||||
def write_str(console, string, encoding="utf-8"):
|
||||
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