parent
2f6ddb49ec
commit
e39b5381ac
20
bin/cat.py
Normal file
20
bin/cat.py
Normal 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
|
Loading…
Reference in New Issue
Block a user