Closes #5
This commit is contained in:
Samuel Sloniker 2022-11-30 19:38:15 -08:00
parent 2f6ddb49ec
commit e39b5381ac
Signed by: kj7rrv
GPG Key ID: 1BB4029E66285A62

20
bin/cat.py Normal file
View File

@ -0,0 +1,20 @@
import os
import console
def get_app_class(template):
class App(template):
def F_main(self):
for file in self.argv[1:]:
try:
with open(file, "rb") as f:
self.console.write(f.read())
except OSError as e:
try:
os.listdir(file)
console.write_str(self.console, f"cat: {path}: Is a directory\n")
except OSError:
console.write_str(self.console, f"cat: {path}: No such file or directory\n")
self.exit()
return App